ZeroDivisionError: float division (baby steps)

From: Artemisio (calidusdk_at_hotmail.com)
Date: 08/19/04


Date: 19 Aug 2004 12:33:54 -0700

I am a non programmer who just started with Python. So far I love it.

I would appreciate if you could help me fix this error I get taking this exercise:

count= 0
sum= 0.0
number= 1
print "Enter 0 to exit the loop"

while number != 0 :
        number= input("Enter a number: ")

count= count + 1
sum= sum + number

count= count -1
print "The average is: ",sum/count
#the error is in the above line

"ZeroDivisionError: float division"

Thank you in advance, Len



Relevant Pages

  • Re: ZeroDivisionError: float division (baby steps)
    ... >> I am a non programmer who just started with Python. ... Note that, even after you fix this, you will still get an error if the user ... I don't actually read my hotmail account, but you can replace hotmail with excite if you really want to reach me. ...
    (comp.lang.python)
  • Re: Pythons simplicity philosophy
    ... the correct Python idiom, ''.join. ... However, if you agree with Paul Graham's theories on language design, ... 'sum' itself lost substantial generality between my original ...
    (comp.lang.python)
  • Re: reduce()--what is it good for? (was: Re: reduce() anomaly?)
    ... I have *never* used sum() that ammounts to sum). ... I don't care about speed all that much when using Python. ... special-purpose feature, while reduceis a very general feature that ... It was just like all the other myriad of programming ...
    (comp.lang.python)
  • Re: fractions summing to a string instead of a number
    ... easy fix is to compare on the Int or the Fix of the total. ... that if they don't sum to 100%, the user is warned by the total turning ... *I've tried it without formatting, and it doesn't change the problem at ...
    (microsoft.public.access.formscoding)
  • Re: OO.o CALC SUM() GIVES WRONG ANSWER
    ... OO.o CALC SUM() GIVES WRONG ANSWER ... Then type "math." ... the obvious way is the right way in Python. ... theoretical and practical background in programming, ...
    (Ubuntu)