**Question** Code Debugging

I am new to python and am having trouble with a homework assignment. We were given lines of code with mistakes that we’re meant to correct; the purpose of the code is to find the min, max, and avg value from a list of numbers. I’ve been able to fix most of the code, but I can’t figure out what is wrong with the sum function. I know that the myCount works, but mySum isn’t getting the right number and therefore the average is messed up.

In the test, the answers should be 1, 3, 2 respectively and I have no idea how the avg is becoming 0.67. Does anyone have any insight?

You are adding mycount by len(listOfNumbers), So you are adding 3 each time, and 6/9 is 0.667. You don’t even need mycount, use this: myAvg = mySum / len(listOfNumbers)


mySum is correct, you just keep adding to myCount the entire length of the list (so myCount will be equal to len(listofNumbers)**2)
try just making myCount = len(listOfNumbers)