error explanation

Steve Holden sholden at holdenweb.com
Mon Sep 29 19:28:08 EDT 2003


"Mac Wood" <malcolm.wood3 at ntlworld.com> wrote in message
news:13df83a2.0309291345.32db8a2b at posting.google.com...
> Could someone please explain this error message:
>
> Traceback (most recent call last):
>   File "C:\Python23\time.py", line 1, in -toplevel-
>     time.py
> NameError: name 'time' is not defined
>
> I tried entering the following example:
>
> time.py
> #This programs calculates rate and distance problems
> print "Input a rate and a distance"
> rate = input("Rate:")
> distance = input("Distance:")
> print "Time:",distance/rate
>
> which according to the tutor should have run as this:
>
> > python times.py
> Input a rate and a distance
> Rate:5
> Distance:10
> Time: 2
> Thanks for your help

Try using raw_input() rather than input()

regards
-- 
Steve Holden                                  http://www.holdenweb.com/
Python Web Programming                 http://pydish.holdenweb.com/pwp/







More information about the Python-list mailing list