I am wanting to write a loop that stays in the loop until a condition is met.
Here's the code so far, and I'm not sure if all is correct, I have little experience in while loops:
x = 2885
y = 1440
difference = 0
while True:
if x > y:
difference = x - y
break
So what I want is to keep subtracting my constant y from x until
y > x
and to have the final
difference = 5
Any help is much appreciated, thanks in advance!
Aucun commentaire:
Enregistrer un commentaire