Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- fox = random.randint(0,900)
- def computer(fox):
- if fox <= 300:
- return 'r'
- elif 300 < fox <= 600:
- return 's'
- else:
- return 'p'
- computer = computer(fox)
- player1 = [0,]
- score2 = [0,]
- number_rounds = int(raw_input('how many rounds? '))
- total1 = len(player1)
- total3 = len(score2)
- while total1 <= number_rounds:
- total1 = len(player1); total2 = len(score2); choose = str(raw_input("Rock, Paper, or Scissors?")); choice = choose.lower()[0:1]
- # score1.append(1); print score1
- def ref(choice, computer):
- if choice == 'r' and computer == 'p':
- return player1.append(1)
- elif choice == 'p' and computer == 'r':
- player1.append(2)
- elif choice == 's' and computer == 'p':
- player1.append(3)
- elif choice == computer:
- pass
- else:
- score2.append(4)
- print "player: %d, cpu: %d" % (total1, total3)
- go = ref(choice, computer); go;print player1, score2
Advertisement
Add Comment
Please, Sign In to add comment