Advertisement
Guest User

Untitled

a guest
Nov 13th, 2018
74
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. options = ['scissors', 'paper', 'rock']
  2. def isValid(p):
  3. if p not in options:
  4. print ('Invalid option, try again: ')
  5. p = input('Scissors, Paper, or Rock? ')
  6. p = isValid(p)
  7. return p
  8. p1 = input('Player 1 Scissors, Paper, or Rock? ').lower().strip(' ,.')
  9. p1 = isValid(p1)
  10. p2 = input('Player 2 Scissors, Paper, or Rock? ').lower().strip(' ,.')
  11. p2 = isValid(p2)
  12. def win1():
  13. return print ('Player 1 Wins')
  14. def win2():
  15. return print ('Player 2 Wins')
  16. if p2 == p1:
  17. print ("tie")
  18. elif p1 == 'rock' and p2 =='scissors':
  19. win1()
  20. elif p1 =='scissors' and p2 =='paper':
  21. win1()
  22. elif p1 == 'paper' and p2 == 'rock':
  23. win1()
  24. else:
  25. win2()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement