You should stop your main loop when you want to exit the game.
My suggestions, either of
finish = Trueand
start = False(though due to some indentation issues with your pasted code it’s not possible to tell that this would actually work)
You should call
pygame.quit() only when you want to terminate your Python session.
My suggestion: if you want to call
game() more than once, e.g. in an interactive session, you should remove the call to
game(). This function uninitializes pygame and naturally all attempts to call its functionality will fail then.