azurepancake
August 21st, 2008, 11:52 PM
Hello all,
Starting last week, I decided I would devote my self to learning some programming. I heard Python was a great language to start with, so I have been trying to learn as much as I can - using http://en.wikibooks.org/wiki/Non-Progra ... for_Python as my guide.
Today, I have started the section about importing and using modules. Here is a link if your interested, http://en.wikibooks.org/wiki/Non-Progra ... ng_Modules. I seem to be having trouble loading and working with modules, here is a bit of code at the end of that section, in which I am trying to get working:
from random import randint
number = randint(0, 99)
guess = -1
while guess != number:
guess = input ("Guess a number: ")
if guess > number:
print "Too high"
elif guess < number:
print "Too low"
print "Just right"
When I attempt to run it, I get the following error:
Original exception was:
Traceback (most recent call last):
File "high_low.py", line 1, in <module>
from random import randint
File "/usr/lib/python2.5/random.py", line 43, in <module>
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
ImportError: cannot import name log
I attempted to search for this error, using Google - but no luck. Am I making a silly mistake? Perhaps I am missing some kind of important add-on for Python? If anyone can shoot me some advice, I will greatly appreciate it.
Thanks in advance!
Starting last week, I decided I would devote my self to learning some programming. I heard Python was a great language to start with, so I have been trying to learn as much as I can - using http://en.wikibooks.org/wiki/Non-Progra ... for_Python as my guide.
Today, I have started the section about importing and using modules. Here is a link if your interested, http://en.wikibooks.org/wiki/Non-Progra ... ng_Modules. I seem to be having trouble loading and working with modules, here is a bit of code at the end of that section, in which I am trying to get working:
from random import randint
number = randint(0, 99)
guess = -1
while guess != number:
guess = input ("Guess a number: ")
if guess > number:
print "Too high"
elif guess < number:
print "Too low"
print "Just right"
When I attempt to run it, I get the following error:
Original exception was:
Traceback (most recent call last):
File "high_low.py", line 1, in <module>
from random import randint
File "/usr/lib/python2.5/random.py", line 43, in <module>
from math import log as _log, exp as _exp, pi as _pi, e as _e, ceil as _ceil
ImportError: cannot import name log
I attempted to search for this error, using Google - but no luck. Am I making a silly mistake? Perhaps I am missing some kind of important add-on for Python? If anyone can shoot me some advice, I will greatly appreciate it.
Thanks in advance!