Class - 12 CBSE Computer Science Important Output Questions 2025
Write the output of the following program on execution if x = 50:
if x > 10:
if x > 25:
print("ok")
if x > 60:
print("good")
elif x > 40:
print("average")
else:
print("no output")
Python
Python Control Flow
1 Like
Answer
ok
Working
The provided code consists of nested conditional statements to determine the output based on the value of the variable x
. If x
is greater than 10, it checks additional conditions. If x
is greater than 25, it prints "ok," and if x
is greater than 60, it prints "good." If x
is not greater than 10 but is greater than 40, it prints "average." Otherwise, if none of the conditions are met, it prints "no output".
Answered By
2 Likes