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(‘ab\ncd\nef’.splitlines())

What will be the output of the following Python code snippet?
print(‘ab\ncd\nef’.splitlines())
a) [‘ab’, ‘cd’, ‘ef’]
b) [‘ab\n’, ‘cd\n’, ‘ef\n’]
c) [‘ab\n’, ‘cd\n’, ‘ef’]
d) [‘ab’, ‘cd’, ‘ef\n’]

Answer: a
Explanation: It is similar to calling split(‘\n’).

Join The Discussion