[Tutor] can't use floor or ceil functions in python

Tom Horton dgrayshn@hotmail.com
Tue, 5 Mar 2002 09:19:35 -0500


Danny and dman,
Thanks that worked like a charm...I hadn't imported the math module properly
but it works now.  I had subscribed for the list minutes after I had sent
this mail out.  The book is pretty good and I'm learning quite a bit from
it.  I have a coding guru down the hall from me whose brain i've been
picking too.  Thanks again for the help.

-Tom Horton

----- Original Message -----
From: "Danny Yoo" <dyoo@hkn.eecs.berkeley.edu>
To: "Tom Horton" <dgrayshn@hotmail.com>
Cc: <tutor@python.org>
Sent: Monday, March 04, 2002 7:07 PM
Subject: Re: [Tutor] can't use floor or ceil functions in python


> On Mon, 4 Mar 2002, Tom Horton wrote:
>
> > I've downloaded and am practicing with Python 2.1.2 for Windows and am
> > reading the book by Ivan Van Laningham titled Teach Yourself Python in
> > 24 hours.
>
> Cool; how is the book?
>
>
> > I'm in the 3rd hour and can't seem to get the floor and ceil (or pi)
> > functions to run.  It says these commands are not defined.  Any ideas?
>
> Those functions and variables should be defined in the 'math' module, so
> you may need to 'import' the math module before playing with it.  Here's
> an example in the interactive interpreter:
>
> ###
> >>> import math
> >>> math.pi
> 3.1415926535897931
> >>> math.ceil(math.pi)
> 4.0
> >>> math.floor(math.pi)
> 3.0
> ###
>
>
> By the way, your post may have been delayed for a few hours because you
> aren't subscribed to Tutor yet; you can subscribe here:
>
>     http://mail.python.org/mailman/listinfo/tutor
>
> and your posts shouldn't get delayed after that.
>
> (This requirement might seem stringent, but we've chosen to do moderation
> on non-subscribers because spammers try abusing us every so often.)
>
>
> If you have more questions, please feel free to ask them.  Best of wishes!
>
>
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor
>