QUESTION IMAGE
Question
what will be the output of this program?
number = 5
less_than_zero = number < 0
if less_than_zero:
print(number)
number = number - 10
less_than_zero = number < 0
if less_than_zero:
print(number)
Step1: Check first condition
number = 5, 5 < 0 is False. So first if block (print(number)) is not executed.
Step2: Update number
number = 5 - 10 = -5.
Step3: Check second condition
-5 < 0 is True. So second if block (print(number)) is executed.
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
-5