samedi 23 septembre 2017

ImportError using python 2.7 random module

I'm trying to create a simple guessing game in python 2.7. The program will come up with a random number using the random module. But when I import it into the script and run it, I get this.

I will now count chickens:
Hens 30
Roosters 97
now i will count the eggs:
7
Is it true that 3 + 2 < 5 - 7?
False
what is 3 + 2? 5
What is 5 - 7 -2
oh, that's why it's False.
How about some more.
is it greater? True
is it greater or equal? True
is it less or equal? False
Traceback (most recent call last):
   File "guessing_game.py", line 1, in <module>
    import random
   File       "/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/random.py", line    45, 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

Anyone have a guess on what's going wrong? I get the same problem importing random in the Python Shell...

I've tried reinstalling Python without any luck




Aucun commentaire:

Enregistrer un commentaire