nerdexam
Python_Institute

PCEP-30-02 · Question #134

The \\n digraph forces the print() function to:

The correct answer is C. break the output line. \n is a newline escape sequence (digraph) that tells print() to break the output line at that point, moving the cursor to the start of the next line - making C correct. Option A is wrong because \n doesn't repeat any character; it represents a single control character. Option B…

Question

The \n digraph forces the print() function to:

Options

  • Aduplicate the character next to the digraph
  • Bstop its execution
  • Cbreak the output line
  • Doutput exactly two characters: \ and n

How the community answered

(51 responses)
  • A
    8% (4)
  • B
    16% (8)
  • C
    73% (37)
  • D
    4% (2)

Explanation

\n is a newline escape sequence (digraph) that tells print() to break the output line at that point, moving the cursor to the start of the next line - making C correct. Option A is wrong because \n doesn't repeat any character; it represents a single control character. Option B is wrong because print() continues executing after the newline - it doesn't stop. Option D is wrong because \n is not output as two literal characters (\ and n); Python interprets it as one invisible newline character before the string ever reaches the screen.

Memory tip: Think of \n as "new line" - the backslash signals "escape to special meaning," and n stands for new line.

Community Discussion

No community discussion yet for this question.

Full PCEP-30-02 Practice