ZeroDivisionError: float division (baby steps)

Timothy Fitz firemoth at gmail.com
Wed Oct 27 14:00:36 EDT 2004


> Well this is what I have so far and I'm not getting my total or average.
> Help (stumped) 
>  # using for loop 
> 
> total = 0 
> count = 10 
> number = 0 
> total += number 
> 
> counter = counter + 1 
> for i in range (10): 
>     number = input("Enter a grade:") 
>     if number == 10: 
>         continue 

I think what you intended was for "total += number" to be in the body
of the loop, so that you are adding up the numbers. As the program was
written you're settings total to 0, then setting number to 0, then
setting total to total + number, which is still zero. Then total is
never modified again so in the end you're just taking 0/10.



More information about the Python-list mailing list