samedi 29 février 2020

Why is my random integer variable not refreshing?

Well, I am working on Python 2.7 and have a bug in my program... Why is the random.randint() variable not refreshing, i.e, not changing its value each time the loop is executed? Here is my code....

import random
handsattack = random.randint(5,10)
userhealth = 1000
while userhealth > 0:
   userhealth -= 30
   y = raw_input("Press enter to display the value of handsattack.. ")
   print(handsattack)



Aucun commentaire:

Enregistrer un commentaire