total = float(sum(numbers))
The instructions actually walk us through the steps, one by one, though you will have seen simplified versions on the forums.
def average(numbers): total = sum(numbers) # first step in instructions total = float(total) # second step total = total / len(numbers) # third step return total
The idea is for us to gain some familiarity with the included concepts.
sum() # function to add up a list of numbers float() # function to cast an integer to a float len() # function to query the length property of a list
See if you can make it work using the exact instructions, and once completed, then try reducing the amount of code as extra practice. Pass the lesson before deviating from the instructions where ever possible.
l have done the same thing as you and it still says average not found
Please post a link to this exercise, as well as the code you have so far. It will be most helpful if you format your code sample so we can see the indentation. Thanks.
def avarage(numbers): total = sum(numbers) total = float(total) total = total/len(numbers) return total
everything is indented besides the def bit
Check your spelling...
This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.