LearnFrenzy
Sign in Take a free test

Python Basics and Syntax · Predict the Output · Question 12

Chaining print() with end Answer, explanation & discussion

  • Output
  • Medium
  • 0 comments
  • Answer explained
  • Moderated community
Question 12 Back to Exercise

What is the output of the following Python program?

main.py
print(end="A")
print("B", end="")
print("C")
print("D", end="\n\n")
print("E")
  • A A B C D E
  • B ABC D E Correct
  • C ABC D E
  • D ABCD E
Correct Answer: Option B

print(end="A") prints no values, only "A". The next two calls continue on the same line. end="\n\n" leaves one blank line before E.

Discussion & Comments 0

Share your method, a shortcut, or ask about a step you didn't follow.

No comments yet. Be the first to share your solution!

Post your comment

Comments appear after a quick review by our team.

Search LearnFrenzy

Esc

Quick links