Welcome to the Treehouse Community
Looking to learn something new?
Abby SchoellerCourses Plus Student 6,187 Points
Joining two lists
I think I am stuck at the bottom, trying to concatenate and print out the joined lists.
words =  numbers =  def combiner(*args): for arg in args: if isinstance(arg, str): words.append(arg) if isinstance(arg, float): numbers.append(arg) full_list = words + numbers.sum() print(full_list.join())
Chris FreemanTreehouse Moderator 68,082 Points
You are on the right path. There are a few items to fix up.
- remove the * from the
argsparameter. The function input will be a single list. By using the *, the function packets the entire list into the first element of the tuple
(["apple", 5, "dog", 8.2], ). This means the
forloop will be seen a
listinstance. It might be better to change the param name to
for item in items
- the empty list initialization should be inside the function definition
- remember to check for integers too:
- the list
numbersdoes not have a
- to join the
wordslist into a single string, use
- be sure to add a string version of the sum to the end of the word string
return the final value. Using
Post back if you have more questions. Good Luck!!