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")
  1. A.

    Syntax Error

  2. B.

    No

  3. C.

    Yes

  4. 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.

Explore the full course: Rssb Senior Computer Instructor