FAQ: Code Challenge: Python Functions - Average

This community-built FAQ covers the “Average” exercise from the lesson “Code Challenge: Python Functions”.

Paths and Courses
This exercise can be found in the following Codecademy content:

Data Science

FAQs on the exercise Average

Join the Discussion. Help a fellow learner on their journey.

Ask or answer a question about this exercise by clicking reply (reply) below!

Agree with a comment or answer? Like (like) to up-vote the contribution!

Need broader help or resources? Head here.

Looking for motivation to keep learning? Join our wider discussions.

Learn more about how to use this guide.

Found a bug? Report it!

Have a question about your account or billing? Reach out to our customer support team!

None of the above? Find out where to ask other questions here!

I am not sure What I am missing. Any help would be appreciated.



I had a little bit of head-scratching when looking at this, but sussed it out.

You need to calculate the total value within the function as a variable then return the variable / 2.

Not sure why you have to do it this way but that’s how I managed to get the result.

Write your average function here:

def average(num1, num2):

total = num1 + num2

return total / 2

Uncomment these function calls to test your average function:

print(average(1, 100))

The average of 1 and 100 is 50.5

print(average(1, -1))

The average of 1 and -1 is 0