[Tutor] cs student needs help import math

Don Jennings dfjennings at gmail.com
Sun Sep 8 02:12:01 CEST 2013


On Sep 7, 2013, at 6:02 PM, Byron Ruffin wrote:

<snip>
> 
> >>> math.ceil(math.pi)
> 4

<snip>

> ... but I get the error when using ceil...
> 
> pepsticks = ceil(peplength / StickLength)
> Traceback (most recent call last):
>   File "<pyshell#19>", line 1, in <module>
>     pepsticks = ceil(peplength / StickLength)
> NameError: name 'ceil' is not defined

Look carefully again at that error. Basically, it's telling you that 'ceil' is not the same as 'math.ceil' which is how you used it correctly the first time. That's an easy mistake to make.

Take care,
Don



More information about the Tutor mailing list