Using strings in lists in functions 16/18


#1

Using strings in lists in functions 16/18

Please could someone explain why this woulldn’t work? I dont understand why I cant use append.

```python

Replace this line with your code.
def join_strings(words):
result = ""
for i in range(len(words)):
result.append(words[i])
return result


#2

The append() method appends a passed object into a list. So as you can see, append() only works with lists. result isn’t a list, so why append() to it?

Hint: Did you see that they didn’t highlight append in the instructions? That means they don’t want you to use that method.


#3

ah okay I understand now. thanks so much :slight_smile:


#4

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.