Using .split() And .join() In Python
I am currently learning some Python in Treehouse, but I came upon this challenge and do not know what I am doing wrong. The challenge is split into three parts, shown below with th
Solution 1:
You should use
display_menu = ", ".join(sundaes)
sundaes
is a list and it doesn't have .join
, you can check by opening a python interpreter and running :
>>> dir(list)
but the string object hast .join
>>> dir(str)
and by running
>>> help(str.join)
we can see the description Help on method_descriptor:
join(...)
S.join(iterable) -> string
Return a string which is the concatenation of the strings in the
iterable. The separator between elements is S.
Post a Comment for "Using .split() And .join() In Python"