## 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.

# Doctest code works in python but not on the test.

when I go into python on a separate window and run the test code it works and returns 1.5 like it should. Why am I not getting it right on the test?

average.py
```def average(num_list):
"""Return the average for a list of numbers

>>>list = [1, 2]
>>>average(list)
1.5

"""
return sum(num_list) / len(num_list)
```

I guess the challenge is pickier than the Python itself.

The challenge wants your test to call the function by passing the test list as a literal and not use an intermediate variable.

The challenge also wants to see a space between the chevrons (>>>) and the function call.

```def average(num_list):
"""Return the average for a list of numbers

>>> average([1, 2])
1.5

"""
return sum(num_list) / len(num_list)
```

</div>

```>>>average([1, 2])
1.5
```

and it was giving me fits. I knew I wasn't that far off. Thanks Steven.

Slightly annoying, but thank you.

```def average(num_list):
"""Return the average for a list of numbers

>>> av = average([1, 2])
>>> av == 1.5
True

"""

return sum(num_list) / len(num_list)
```