## Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

### Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

# Hello there! I'm really stuck with this challenge. Is there any way you could explain it to me? Thank you!

I have no idea what i'm doing.

functions.py
```# add_list([1, 2, 3]) should return 6
# summarize([1, 2, 3]) should return "The sum of [1, 2, 3] is 6."
# Note: both functions will only take *one* argument each.

list.append(num)
print(num+num)

def num():
print(num)
```

MOD

Breaking it down it can be solved using the code below:

```def add_list(nums):
'''Make a function named add_list that takes a list.
The function should then add all of the items in the
list together and return the total.
'''
# Sume the elements of a list using a loop:
result = 0
for num in nums:
result += num
# Return the result
return result

def summarize(nums):
'''Now, make a function named summarize that also
takes a list. It should return the string
"The sum of X is Y.", replacing "X" with the string
version of the list and "Y" with the sum total of the list.
'''
# sum the values in list
# Format result string with original list and total
result = "The sum of {x} is {y}".format(x=nums, y=total)
# returrn result
return result
```

These can be compressed to:

```def add_list(nums):
'''Make a function named add_list that takes a list.
The function should then add all of the items in the
list together and return the total.
'''
# Using sum() instead of loop to add the elements of a list
return sum(nums)

def summarize(nums):
'''Now, make a function named summarize that also
takes a list. It should return the string
"The sum of X is Y.", replacing "X" with the string
version of the list and "Y" with the sum total of the list.
'''
return "The sum of {x} is {y}".format(x=nums, y=add_list(nums))
```
PLUS

The challenge is asking for two functions. The first is going to find the sum of all the numbers in a list. The second is going to show the user what was in the list and what the total is.

```def add_list (list):
total = 0
for item in list:
total += item

def summarize (list):
string = str(list)
return "The sum of "+list+" is "+str(total)
```

Hello!

The challenge would like you to create two functions: one called `add_list` that takes a list as an argument, and the other called `summarize`, which also takes a list as an argument. That would look look like this.

```# add_list([1, 2, 3]) should return 6
# summarize([1, 2, 3]) should return "The sum of [1, 2, 3] is 6."
# Note: both functions will only take *one* argument each.