dimanche 1 avril 2018

AttributeError: module 'random' has no attribute 'randint'

Code:

import turtle
import random
turtle.penup()
for i in range(20):
    x=random.randint(-200,200)
    y=random.randint(-200,200)
    turtle.setposition(x,y)
    turtle.dot()
turtle.done()

Error:

F:\Python>random.py
Traceback (most recent call last):
  File "F:\Python\random.py", line 2, in <module>
    import random
  File "F:\Python\random.py", line 5, in <module>
    x=random.randint(-200,200)
AttributeError: module 'random' has no attribute 'randint'




Aucun commentaire:

Enregistrer un commentaire