vendredi 19 février 2016

Why does this code loop past 100?

I am running this code from a Youtube video; its supposed to stop looping at 100, yet it goes above. Anyone know where the error might be?

import random

sarge_is_awake = True count = 0

while sarge_is_awake: print "Down!" print "Up!" count = count + 1 print str(count) + " done"

if random.randrange (0, 100) == 0:
    sarge_is_awake = False




Aucun commentaire:

Enregistrer un commentaire