Learn
Lists and Functions
Using strings in lists in functions

Now let’s try working with strings!

for item in list: print item for i in range(len(list)): print list[i]

The example above is just a reminder of the two methods for iterating over a list.

Instructions

1.

Create a function that concatenates strings.

  • Define a function called join_strings accepts an argument called words. It will be a list.
  • Inside the function, create a variable called result and set it to "", an empty string.
  • Iterate through the words list and concatenate each word to result.
  • Finally, return the result.

Don’t add spaces between the joined strings!

Folder Icon

Take this course for free

Already have an account?