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 snippet?
print(‘xyyxyyxyxyxxy’.replace(‘xy’, ’12’, 0))

What will be the output of the following Python code snippet?
print(‘xyyxyyxyxyxxy’.replace(‘xy’, ’12’, 0))
a) xyyxyyxyxyxxy
b) 12y12y1212x12
c) 12yxyyxyxyxxy
d) xyyxyyxyxyx12

Answer: a
Explanation: The first 0 occurrences of the given substring are replaced.

Join The Discussion