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

dman dsh8290@rit.edu
Mon, 4 Mar 2002 19:09:00 -0500

On Mon, Mar 04, 2002 at 03:24:36PM -0500, Tom Horton wrote:
| Hi all,
| 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.  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?

I don't have the book so I can't see what the example shows.  Can you
post the code?  Can you post what you tried?  Just copy-n-paste from
the interactive interpreter.

My guess is that you haven't imported the "math" module, or that you
aren't qualifying the names of the functions.  Here's an example that
works :

import math
print math.pi
print math.floor( 31.58889 )
print math.ceil( 31.58889 )



The teaching of the wise is a fountain of life,
turning a man from the snares of death.
        Proverbs 13:14