Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialTemidayo Soneye
267 PointsWhat does passed-in list mean? Does it mean user inputted values?
I am not sure what the term passed-list means.
2 Answers
Ricky Catron
13,023 PointsI noticed you said you think you understand it but can you please post your progress so if someone else searches the problem on the forum they can find you solution?
My solution would be:
def add_list(passed_in_list):
#passed_in_list is what the function takes as input
#it is called like so add_list(list_to_be_passed_in)
#each value in the list will be added to sum but at the beginning sum is zero
sum = 0
#this iterates through each item in the list and adds it to the sum
for num in passed_in_list:
sum = sum + num
#this send the sum back to whatever called the function
return sum
Edit: Added comments everywhere
Kenneth Love
Treehouse Guest Teacher"passed-in" just means that the variable will be provided from somewhere outside of your code.