jeudi 18 novembre 2021

'forward' is not defined [duplicate]

Sorry for dumb question, i'm new to python

What i've writed in code:

import time
from random import randint
from turtle import *
while True:
    if randint(1,2) == 1:
        forward(randint(20,100))
    else:
        backward(randint(20,100))
    if randint(1,2) == 1:
        right(randint(20,100))
    else:
        left(randint(20,100))

What i've got in output:

  File "C:\Users\amogus\Desktop\python\turtle.py", line 4, in <module>
    from turtle import *
  File "C:\Users\amogus\Desktop\python\turtle.py", line 7, in <module>
    forward(randint(20,100))
NameError: name 'forward' is not defined

Can someone help with this?




Aucun commentaire:

Enregistrer un commentaire