Bird
0
0

What will be the output of this code?

medium📝 Predict Output Q5 of 15
Python - Basics and Execution Environment
What will be the output of this code?
# print('Test')
print('Python')
ATest\nPython
BTest
CPython
DNo output
Step-by-Step Solution
Solution:
  1. Step 1: Analyze commented line

    The line # print('Test') is a comment and will not execute.
  2. Step 2: Analyze executable line

    The line print('Python') will print the string 'Python'.
  3. Final Answer:

    Python -> Option C
  4. Quick Check:

    Commented lines do not execute, only print('Python') runs [OK]
Quick Trick: Lines starting with # do not execute [OK]
Common Mistakes:
MISTAKES
  • Assuming commented code runs
  • Expecting both lines to print

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes