Search This Blog
hello everyone myself Jasskeerat singh and I will post my blogs and learn blogging
Featured
- Get link
- X
- Other Apps
rock paper scissors with python
rock paper scissors
I am sorry for not posting any blog as I am learning php and after I learn I will make files and share with you all and one more thing is that this is my first blog which I am building using html.
      
      import random
      
choices = ["rock","paper","scissors"]
      
print("rock crushes scissors. scissors cut paper. paper covers rock.")
       
player = input("do you want to be rock, paper, or scissors(or q to quit)?")
       
while player != "q":
       
    player = player.lower()
       
    computer = random.choice(choices)
       
    print("You choose " + player + ", and the computer choose " + computer)
       
    if player == computer:
       
        print ("IT's a Tie")
       
    elif player == "rock":
       
        if computer == "scissors":
       
            print("you win")
       
        else:
       
            print("computer wins")
       
    elif player == "paper":
       
        if computer == "rock":
       
            print("You win")
       
        else:
       
            print("computer wins")
       
    elif player == "scissors":
       
        if computer == "paper":
       
            print("you win")
       
        else:
       
            print("computer wins")
       
    else:
       
        print("I think there was some error...")
       
    print()
       
    player = input("do you want to be rock , paper or scissors(or q)? ")
    
    
      
    
please try this source code and tell it works or not in the comment below.
- Get link
- X
- Other Apps
Comments
Post a Comment