Bird
0
0

What will be the output of this code?

medium📝 Predict Output Q4 of 15
Python - Basics and Execution Environment
What will be the output of this code?
print('Start')  # This is a comment
# print('Hidden')
print('End')
AStart Hidden End
BStart End
CStart # print('Hidden') End
DSyntax Error
Step-by-Step Solution
Solution:
  1. Step 1: Identify which lines run

    Lines starting with # are comments and ignored, so print('Hidden') does not run.
  2. Step 2: Determine output

    Only print('Start') and print('End') run, so output is Start and End on separate lines.
  3. Final Answer:

    Output is Start followed by End on new lines. -> Option B
  4. Quick Check:

    Comments ignored output = C [OK]
Quick Trick: Lines starting with # do not run [OK]
Common Mistakes:
MISTAKES
  • Expecting commented print to run
  • Confusing comment with string
  • Thinking comments print text

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes