Bird
0
0

What is the output of this code?

medium📝 Predict Output Q13 of 15
Python - Input and Output
What is the output of this code?
print('A', 'B', 'C', sep='*', end='!')
print('D')
AA*B*C!D
BA B C ! D
CA*B*C D
DA B C!D
Step-by-Step Solution
Solution:
  1. Step 1: Analyze first print()

    It prints 'A', 'B', 'C' separated by '*', ending with '!'. So output is 'A*B*C!'
  2. Step 2: Analyze second print()

    It prints 'D' on the same line because first print ended with '!' (no newline).
  3. Final Answer:

    A*B*C!D -> Option A
  4. Quick Check:

    sep='*', end='!' joins and ends line [OK]
Quick Trick: Remember end='' keeps output on same line [OK]
Common Mistakes:
MISTAKES
  • Assuming default space separator
  • Thinking end adds newline
  • Ignoring end parameter effect

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes