Single Choice Not Set

QOutput displayed by the print function will add this invisible character at the end of the line by default ...

ID: #3396 Python Basic MCQ 574 views
Question Info
#3396Q ID
Not SetDifficulty
Python Basic MCQTopic

Choose the Best Option

Click any option to instantly check if you're correct.

  • A backslash t
  • B backslash n
  • C backslash s
  • D backslash r
Correct Answer

Explanation

By default, the print() function ends its output with the newline character \n. This moves the cursor to the beginning of the next line after displaying the output.

Example:

print("Hello")
print("World")

Output:

Hello
World

This happens because the default value of the end parameter in the print() function is "\n".

Example:

print("Hello", end="\n")
print("World")

The other options are incorrect because:

  • \t represents a horizontal tab.
  • \s is not a valid Python escape sequence.
  • \r represents a carriage return.

Therefore, the correct answer is Option B) \n.

Share This Question

Challenge a friend or share with your study group.