dimanche 15 novembre 2020

learning random function in Python

I have got the following error message for the script below. Can someone tell me what is the mistake I have made?

Traceback (most recent call last):
  File "random.py", line 1, in <module>
    import random
  File "C:\Users\premj\Desktop\py4e\random.py", line 4, in <module>
    x = random.random()
TypeError: 'module' object is not callable
import random

for i in range(10):
    x = random.random()
    print (x)



Aucun commentaire:

Enregistrer un commentaire