Python code for game