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 trial
Jameson Remick565 Points
Am I supposed to do this whole thing with just one function? And without actually making a list?
How can I make a list and add up the numbers in one function? Wouldn't I have to start with a list, define a function to add numbers to the list, and then define another function to add the numbers in the list up? Or am I missing something/overthinking this?
You might be a tad overthinking this. The question will give you a list when you check your code so you don't have to worry about the list. The challenge will give you a list looking like this
[1, 2, 3, 4, 5, 6]
After you created your
add_list function and created an argument you will want to create a for loop to loop through each number and then add it to a sum variable (or any variable name of your chosen). Here is how I accomplished this.
sum = 0
for nums in x:
sum += nums
I hope this helped. If you have any other question don't hesitate to ask.