Re: ZeroDivisionError: float division (baby steps)
From: Russell Blau (russblau_at_hotmail.com)
Date: 08/19/04
- Next message: Porky Pig Jr: "IDLE under Cygwin - no toolbar menu. Any idea why?"
- Previous message: Peter Hansen: "Re: Alternative decorator syntax decision"
- In reply to: Benjamin Niemann: "Re: ZeroDivisionError: float division (baby steps)"
- Next in thread: Artemisio: "Re: ZeroDivisionError: float division (baby steps)"
- Reply: Artemisio: "Re: ZeroDivisionError: float division (baby steps)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Thu, 19 Aug 2004 16:13:56 -0400
"Benjamin Niemann" <pink@odahoda.de> wrote in message
news:cg3184$vbr$02$1@news.t-online.com...
> 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...
Note that, even after you fix this, you will still get an error if the user
decides to enter "0" as the first number!
-- I don't actually read my hotmail account, but you can replace hotmail with excite if you really want to reach me.
- Next message: Porky Pig Jr: "IDLE under Cygwin - no toolbar menu. Any idea why?"
- Previous message: Peter Hansen: "Re: Alternative decorator syntax decision"
- In reply to: Benjamin Niemann: "Re: ZeroDivisionError: float division (baby steps)"
- Next in thread: Artemisio: "Re: ZeroDivisionError: float division (baby steps)"
- Reply: Artemisio: "Re: ZeroDivisionError: float division (baby steps)"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|