adplus-dvertising
frame-decoration

Question

What is the output of the following piece of code?
s="a@b@c@d"
a=list(s.partition("@"))
print(a)
b=list(s.split("@",3))
print(b)

a.

[‘a’,’b’,’c’,’d’].
[‘a’,’b’,’c’,’d’].

b.

[‘a’,’@’,’b’,’@’,’c’,’@’,’d’].
[‘a’,’b’,’c’,’d’].

c.

[‘a’,’@’,’b@c@d’].
[‘a’,’b’,’c’,’d’].

d.

[‘a’,’@’,’b@c@d’].
[‘a’,’@’,’b’,’@’,’c’,’@’,’d’].

Posted under Python

Answer: (c).[‘a’,’@’,’b@c@d’].
[‘a’,’b’,’c’,’d’].

Engage with the Community - Add Your Comment

Confused About the Answer? Ask for Details Here.

Know the Explanation? Add it Here.

Q. What is the output of the following piece of code?