Bird
0
0

What will be the output of the following code?

medium📝 Predict Output Q4 of 15
Python - Input and Output
What will be the output of the following code?
print('Python', 'is', 'fun', sep='*', end='!')
APython is fun\n
BPython is fun!
CPython*is*fun\n
DPython*is*fun!
Step-by-Step Solution
Solution:
  1. Step 1: Understand sep and end parameters

    The sep='*' inserts '*' between arguments. The end='!' replaces the default newline with '!'.
  2. Step 2: Combine the effects

    Arguments 'Python', 'is', 'fun' are joined with '*', then the line ends with '!'.
  3. Final Answer:

    Python*is*fun! -> Option D
  4. Quick Check:

    sep='*' and end='!' produce output [OK]
Quick Trick: sep sets separator, end sets line ending [OK]
Common Mistakes:
MISTAKES
  • Ignoring end parameter
  • Assuming default newline
  • Confusing sep and end

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Python Quizzes