Another update from ingydotnet^djgoku
This commit is contained in:
parent
91df62d461
commit
948b86eafa
7604 changed files with 108452 additions and 22726 deletions
|
|
@ -17,7 +17,6 @@ while True:
|
|||
print('yay you win!')
|
||||
elif rules[human] == computer: # if what beats the human's choice is the computer's choice...
|
||||
print('the computer beat you... :(')
|
||||
else:
|
||||
print("it's a tie!")
|
||||
else: print("it's a tie!")
|
||||
|
||||
else: print("that's not a valid choice")
|
||||
10
Task/Rock-paper-scissors/Python/rock-paper-scissors-2.py
Normal file
10
Task/Rock-paper-scissors/Python/rock-paper-scissors-2.py
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
from random import randint
|
||||
|
||||
hands = ['rock', 'scissors', 'paper']; judge = ['its a tie!', 'the computer beat you... :(', 'yay you win!']
|
||||
while True:
|
||||
try:
|
||||
YOU = hands.index(input('Choose your weapon: ')) # YOU = hands.index(raw_input('Choose your weapon: ')) If you use Python2.7
|
||||
except ValueError:
|
||||
break
|
||||
NPC = randint(0, 2)
|
||||
print('The computer played ' + hands[NPC] + '; ' + judge[YOU-NPC])
|
||||
Loading…
Add table
Add a link
Reference in a new issue