Creating strings from a list of words is something you will do frequently when writing Python code. This lesson showed you how to create strings using str.join()
.
words = ['cat', 'dog', 'horse', 'human']
print ' '.join(words)
This will print each word contained in words
separated by a space.
gracebr28 on June 4, 2019
Shouldn’t the print_strings_good function be like this? def print_strings_good (strings): print (‘ ‘.join(strings)) #use input instead
Instead of the list name, .join should pass the name of the function input (strings in this case) instead, so that when we call the function we can print any list that we want.