Mega Code Archive

 
Categories / Python / Language Basics
 

While loop

health = 10 trolls = 0 damage = 3 while health >0:        #!= 0:     trolls += 1     health = health - damage          print " " \           "but takes", damage, "damage points.\n" print " ", trolls, "trolls."