Important Python Mcqs

What will be the output of the following Python code? print (r”\nhello”)

a) a new line and hello

b) \nhello

c) the letter r and then hello

d) error

Answer:

b) \nhello

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.

Related MCQs
Aniket Malik

Aniket Malik

CERTIFIED TUTOR/TRAINER WITH 300+ REVIEWS

Facing difficulty with

this concept?