Exercise:
import easygui as g
import random as r
g.msgbox("Do you start game?",title = "Guessing Game",image =
"guess.gif")
rand = r.randint(1,3)#computer's random input
computer = "Computer's input"
if rand == 1:
computer = "Rock"
elif rand == 2:
computer = "Scissor"
else:
computer = "Paper"
person = g.buttonbox(msg="Please input.",title = "Guessing Game",choices = ("Rock","Scissor","Paper"),
image = "guess.gif")
if person == computer:
g.msgbox("You input: "+person+",Computer's input: "+computer+". Tie",title = "Guessing Game",
image = "h.gif")
elif (rand == 1 and person == "Paper") or (rand == 2 and person == "Rock") or (rand == 3
and person == "Scissor"):
g.msgbox("You input: "+person+",Computer's input: "+computer+". You Win!",title = "Guessing Game",
image = "y.gif")
else:
g.msgbox("You input: "+person+",Computer's input: "+computer+". You Lose!",title = "Guessing Game",
image = "s.gif")
[…] 15 Nested if Statements| |____Unit 16 Practice| |____Unit 17 Rock Paper Scissor Shoot I| |____Unit 18 Rock Paper Scissor Shoot II|____Python Level 3| |____Unit 19 while loop| |____Unit 20 while loop practice| |____Unit 21 guess […]