Skip to content

Instantly share code, notes, and snippets.

@JayeshTiwari03
Created February 27, 2018 11:43
Show Gist options
  • Save JayeshTiwari03/1da6147eb8e8afba4bdf6c11a099340e to your computer and use it in GitHub Desktop.
Save JayeshTiwari03/1da6147eb8e8afba4bdf6c11a099340e to your computer and use it in GitHub Desktop.
#!/bin/python3
from random import randint
player = input("rock, paper or scissor")
print(player, "vs", end=' ')
chosen = randint(1, 3)
if chosen == 1:
computer = 'rock'
elif chosen == 2:
computer = 'paper'
else:
computer = 'scissor'
print(computer)
if player == computer:
print('DRAW!')
elif player == 'rock' and computer == 'scissor':
print('Player wins!')
elif player == 'rock' and computer == 'paper':
print('Computer wins!')
elif player == 'paper' and computer == 'rock':
print('Player wins')
elif player == 'paper' and computer == 'scissor':
print('Computer wins!')
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment