Select the correct output for the following Python code: a = 20 b = 35 if a >=…
2024
Select the correct output for the following Python code:
a = 20
b = 35
if a >= b:
print("yes")
else:
print("No")- A.
Syntax Error
- B.
No
- C.
Yes
- D.
Error
Attempted by 111 students.
Show answer & explanation
Correct answer: B
Correct answer: No
In the corrected code, the print statement under if and the print statement under else are indented.
Here, a = 20 and b = 35. The condition a >= b is false because 20 is not greater than or equal to 35.
So the else block runs and prints No.