Bird
0
0

What is the output of this code?

medium📝 Predict Output Q4 of 15
Python - Conditional Statements
What is the output of this code?
score = 75
result = 'Pass' if score >= 60 else 'Fail'
print(result)
AFail
BPass
C75
DError
Step-by-Step Solution
Solution:
  1. Step 1: Evaluate the condition

    score is 75, which is greater than or equal to 60, so condition is True.
  2. Step 2: Determine the ternary result

    Since condition is True, result is 'Pass'.
  3. Final Answer:

    Pass -> Option B
  4. Quick Check:

    Condition True = Pass [OK]
Quick Trick: True condition picks first value [OK]
Common Mistakes:
MISTAKES
  • Confusing condition direction
  • Printing variable instead of result
  • Expecting numeric output

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes