Sovi.AI - AI Math Tutor

Scan to solve math questions

QUESTION IMAGE

question 7 given input 10, what is the final value of positive_num? pos…

Question

question 7
given input 10, what is the final value of positive_num?
positive_num = int(input(\enter a positive number!\))
if positive_num < 0:
print(
egative input set to 0\)
positive_num = 0
0
error
10

Explanation:

Step1: Analyze the if - condition

The if - condition checks if positive_num < 0. Given input is 10, 10 is not less than 0. So the code block inside the if statement (printing "Negative input set to 0" and setting positive_num = 0) is not executed.

Step2: Determine the final value

Since the if - block is not executed, the value of positive_num remains the input value, which is 10.

Answer:

C. 10