Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- #these will be the computers choices chosen at random for each round
- c = ['rock', 'paper', 'scissors']
- computer = random.choice(c)
- player = False
- while player == False:
- #player can input only rock, paper, scissors
- player = input('rock, paper or scissors? ')
- if player == computer:
- print('You tied, try again')
- elif player == 'rock':
- if computer == 'paper':
- print('You lose!', computer, 'covers', player)
- else:
- print('You win!', player, 'smashes', computer)
- elif player == 'paper':
- if computer == 'scissors':
- print('You lose!', computer, 'cuts', player)
- else:
- print('You win!', player, 'covers', computer)
- elif player == 'scissors':
- if computer == 'rock':
- print('You lose!', computer, 'smashes', player)
- else:
- print('You win!', player, 'cuts', computer)
- else:
- print('Check your spelling and try again')
- player = False
- computer = random.choice(c)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement