Beginner question
eschneider92 at comcast.net
eschneider92 at comcast.net
Mon Jun 3 23:39:28 EDT 2013
Is there a more efficient way of doing this? Any help is gratly appreciated.
import random
def partdeux():
print('''A man lunges at you with a knife!
Do you DUCK or PARRY?''')
option1=('duck')
option2=('parry')
optionsindex=[option1, option2]
randomizer=random.choice(optionsindex)
while randomizer==option1:
if input() in option1:
print('he tumbles over you')
break
else:
print('he stabs you')
break
while randomizer==option2:
if input() in option2:
print('you trip him up')
break
else:
print('he stabs you')
break
partdeux()
More information about the Python-list
mailing list