QUESTION IMAGE
Question
what does this program print?
temperature = 65
while temperature < 80:
print(\its still a nice day\)
if temperature < 70:
temperature = temperature + 5
elif temperature > 75:
break
else:
temperature = temperature + 3
Step1: First iteration
Initial temperature = 65. Since 65 < 80, print "It's still a nice day". Then, as 65 < 70, temperature = 65 + 5=70.
Step2: Second iteration
Now temperature = 70. Since 70 < 80, print "It's still a nice day". Then, as 70 is not <70 (first if condition false) and not >75 (second elif condition false), enter else block. So temperature = 70+ 3 = 73.
Step3: Third iteration
Now temperature = 73. Since 73 < 80, check conditions. 73 is not <70 (first if condition false) and not >75 (second elif condition false). So temperature = 73+3 = 76.
Step4: Fourth iteration
Now temperature = 76. Since 76 < 80, check conditions. As 76>75, break out of the while loop.
Snap & solve any problem in the app
Get step-by-step solutions on Sovi AI
Photo-based solutions with guided steps
Explore more problems and detailed explanations
It's still a nice day
It's still a nice day