This is a assignment I have to do for school.
The program is about attack and defend. This is how it suppose to look like when it outputs: http://i43.tinypic.com/bew6q.jpg
Mine is basically done accept the part where it says "Your Health is:" the health is suppose to be "health = 20" when it starts off.. when it attacks the random die will roll and the health will "Health = health - x" where x = die roll (random number) but it's not showing or working....
This is mine:
health = 20 import random def Dieroll(): randomnumber = random.randrange(10)+1 return randomnumber def Healthmod(): x = Dieroll() global health health = health - x #main while True: action = raw_input("Do you want to Attack or Defend? ") if action == "attack": print "You are attacking!" print "Your health is ", health elif action == "defend": print "You are defending!" else: print "Type 'attack' or 'defend'!" print "Your health is ", health if health < 0: print "You're dead." raw_input ("Press a key to exit.")