I am using a while loop inside a if / else condition. For some reason under one condition the while loop does not work. The condition is shown in my code below. Under these conditions I would assume that the else condition should be utilized and the weight and the max_speed should be decreased until both while conditions are not valid anymore. What am I doing wrong?
weight = 0
max_speed = 15
if weight == 0 and max_speed <= 10:
while weight == 0 and max_speed <= 10:
weight=weight+1
print(weight)
print(max_speed)
else:
while weight != 0 and max_speed > 10:
weight = weight-1
max_speed=max_speed-1
print(weight)
print(max_speed)
Aucun commentaire:
Enregistrer un commentaire