Every line of 'how to make games in python' code snippets is scanned for vulnerabilities by our powerful machine learning engine that combs millions of open source libraries, ensuring your Python code is secure.
31 def game(player_choice): 32 print() 33 name = player_choice 34 print(name) 35 number = name_to_number(name) 36 comp_number = random.randrange(0, 2) 37 comp_choice = number_to_name(comp_number) 38 print(comp_choice) 39 40 comp = -int(comp_number) 41 play = int(number) 42 diff = (comp + play) % 5 43 44 if diff == 1 or diff == 3: 45 print("you won!!!") 46 elif diff == 0: 47 print("draw") 48 elif diff == 2 or diff == 4: 49 print("you lose!!!")