Saturday, 28 September 2013

Turning a random choice answer to and if statment

Turning a random choice answer to and if statment

I am creating text based game in python 3.3.2 and I want to after the
attack either misses or hits (chosen randomly)you get a difrent messege
depending on what happens. this is the code so far
print ("A huge spider as large as your fist crawls up your arm. Do you
attack it? Y/N")
attack_spider = input ()
#North/hand in hole/keep it in/attack
if attack_spider == "Y":
attack = ['Miss', 'Miss', 'Miss', 'Miss', 'Hit']
from random import choice
print (choice(attack))
I imaging it goes something like
if attack == 'Miss':
print ("You made the spider angry")
but this does not seen to work. is it possible to do this?

No comments:

Post a Comment