Register Now

Login

Lost Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

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

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
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.

Join The Discussion