While loop : While : Language Basics PYTHON examples


PYTHON examples » Language Basics » While »

 

While loop


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."
           
         
  



Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .


PYTHON examples

 Navioo Language Basics
» While