loops

+2 Jeff the Killer · November 4, 2015
print("play rock paper scissors.")
rock="rock"
paper="paper"
scissor="scissor"
human= input()
if human==rock:
   human=rock
   print("You chose " + rock)
elif human==paper:
    human=paper
    print("You chose " + paper)
elif human==scissor:
    human=scissor
    print("You chose " + scissor)
else: print("invalid choice")



   import random
   computer_choice=random.randint(1,3)
   if computer_choice==1:
       computer_choice="rock"
   elif computer_choice==2:
       computer_choice="paper"
   elif computer_choice==3:
       computer_choice="scissor"





   if computer_choice=="rock" and human=="rock":
          print("tie")
   elif computer_choice=="rock" and human=="paper":
          print("you win")
   elif computer_choice=="rock" and human=="scissors":
          print("you lose")
          
   elif computer_choice=="paper" and human=="paper":
          print ("tie")
   elif computer_choice=="paper" and human=="rock":
          print ("you lose")
   elif computer_choice=="paper" and human=="scissor":
          print ("you win")
          
   elif computer_choice=="scissor" and human=="paper":
         print ("you lose")
   elif computer_choice=="scissor" and human=="rock":
         print ("you win")
   elif computer_choice=="scissor" and human=="scissor":
         print ("tie")
   elif computer_choice=="scissor" and human=="paper":
          print ("you lose")
   elif computer_choice=="scissor" and human=="rock":
          print ("you win")
   elif computer_choice=="scissor" and human=="scissor":
          print ("tie")

   print(computer_choice)



#I want to loop the game to keep on repeating every time computer_choice gives an answer. how to do it? P
#PS is there a way on how to exclude a function like make it not work

Post a Reply

Replies

Oldest  Newest  Rating
0 Balaskandan Giri · November 4, 2015
include while(1):
0 Jeff the Killer · November 5, 2015
thanks for the tip
  • 1

Python

107,003 followers
About

This section is all about snakes! Just kidding.

Links
Moderators
Bucky Roberts Administrator