stage.set_background("summer")
sprite_maria = codesters.Sprite("person1",-50,-50)
sprite_maria.say("Hi. I am Maria.")
stage.wait(2)
sprite_maria.say("Would you like to play rock, paper, and scissors?")
stage.wait(2)
choices = ["rock", "paper", "scissors"]
again = "yes"
while again == "yes":
user_choice = sprite_maria.ask("rock, paper, or scissors?")
user_choice = user_choice.lower()
stage.wait(2)
if user_choice in choices:
comp_choice = random.choice(choices)
sprite_maria.say("Computer picked ", comp_choice)
stage.wait(5)
if user_choice == comp_choice:
sprite_maria.say("Tied, try again!")
elif user_choice == "rock" and comp_choice == "scissors":
sprite_maria.say("You win!")
elif user_choice == "paper" and comp_choice == "rock":
sprite_maria("You win!")
elif user_choice == "scissors" and comp_choice == "paper":
sprite_maria.say("You win!")
else:
sprite_maria.say("Sorry, computer wins!")
else:
print("Sorry, " + user_choice + " is not a valid choice")
stage.wait(3)
again = sprite_maria.ask("Play again, yes/no?")
again = again.lower()
-
Run Code
-
-
Stop Running Code
-
Show Chart
-
Show Console
-
Codesters How To (opens in a new tab)