Home / CSE MCQs / Python MCQs :: Discussion

Discussion :: Python MCQs

  1. What is the output when following code is executed ?

    print r"\nhello"
    The output is
  2. A.
    a new line and hello
    B.
    \nhello
    C.
    the letter r and then hello
    D.
    Error

    View Answer

    Workspace

    Answer : Option B

    Explanation :

    When prefixed with the letter 'r' or 'R' a string literal becomes a raw string and the escape sequences such as \n are not converted.


Be The First To Comment