mburton2

Untitled

Sep 7th, 2014
282
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.01 KB | None | 0 0
  1. import random
  2. fox = random.randint(0,900)
  3.  
  4.  
  5. def computer(fox):
  6.     if fox <= 300:
  7.         return 'r'
  8.     elif 300 < fox <= 600:
  9.         return 's'
  10.     else:
  11.         return 'p'
  12. computer = computer(fox)
  13.  
  14. player1 = [0,]
  15. score2 = [0,]
  16. number_rounds = int(raw_input('how many rounds? '))
  17. total1 = len(player1)
  18. total3 = len(score2)
  19.  
  20. while total1 <= number_rounds:
  21.     total1 = len(player1); total2 = len(score2); choose = str(raw_input("Rock, Paper, or Scissors?")); choice = choose.lower()[0:1]
  22. #    score1.append(1); print score1
  23.     def ref(choice, computer):
  24.         if choice == 'r' and computer == 'p':
  25.             return player1.append(1)
  26.         elif choice == 'p' and computer == 'r':
  27.             player1.append(2)
  28.         elif choice == 's' and computer == 'p':
  29.             player1.append(3)
  30.         elif choice == computer:
  31.             pass
  32.         else:
  33.             score2.append(4)
  34.     print "player: %d, cpu: %d" % (total1, total3)
  35.     go = ref(choice, computer); go;print player1, score2
Advertisement
Add Comment
Please, Sign In to add comment