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

发表评论

电子邮件地址不会被公开。 必填项已用*标注