Re: ZeroDivisionError: float division (baby steps)
From: Benjamin Niemann (pink_at_odahoda.de)
Date: 08/19/04
- Next message: Peter Hansen: "Re: Alternative decorator syntax decision"
- Previous message: md: "Re: apache 2 & python"
- In reply to: Artemisio: "ZeroDivisionError: float division (baby steps)"
- Next in thread: Russell Blau: "Re: ZeroDivisionError: float division (baby steps)"
- Reply: Russell Blau: "Re: ZeroDivisionError: float division (baby steps)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 19 Aug 2004 22:05:48 +0200
Artemisio wrote:
> 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
I think the two lines after input() should be indented as the belong to
the while loop...
- Next message: Peter Hansen: "Re: Alternative decorator syntax decision"
- Previous message: md: "Re: apache 2 & python"
- In reply to: Artemisio: "ZeroDivisionError: float division (baby steps)"
- Next in thread: Russell Blau: "Re: ZeroDivisionError: float division (baby steps)"
- Reply: Russell Blau: "Re: ZeroDivisionError: float division (baby steps)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|