Generation

generate functionThu, 06 Jul 2023

play a game of rock paper scissors against a bot

import random def rps(user_choice): # todo: start a game of rock paper scissors! #rock = 1, paper =2, scissors =3 computer_choice = random.randint(1, 3) print("User choice: " + str(user_choice)) print("Computer choice: " + str(computer_choice)) if user_choice == computer_choice: print("Draw!") elif user_choice == 1 and computer_choice == 2: print("User loses!") elif user_choice == 1 and computer_choice == 3: print("User wins!") elif user_choice == 2 and computer_choice == 1: print("User wins!") elif user_choice == 2 and computer_choice == 3: print("User loses!") elif user_choice == 3 and computer_choice == 1: print("User loses!") elif user_choice == 3 and computer_choice == 2: print("User wins!")

Want to kickstart your project?Use the new AI Studio to create your code