Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

what will be the output of this program? number = 5 less_than_zero = nu…

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)

Explanation:

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.

Answer:

-5