lundi 25 juillet 2016

print one time uniqe variable in if or while statement python

Is there a way to see / print looping variables which have unique values?

for an example:

while random.randint(0,15) != 7:

If I do:

while random.randint(0,15) != 7:
     print (random.randint(0,15))

I won't get the same result as it was produced in while loop It can happen while statement generates seven, but print statement would produce different number. So how to see through what variables were you really looping?

Aucun commentaire:

Enregistrer un commentaire