from random import random ,choices
from turtle import Turtle ,Screen
p=Turtle()
p.color("red")
n=(1,2,3,4)
for f in range(0,50,+1):
n=["1","2","3","4"]
c=random.choice(n)
if c==1:
p.forward(20)
if c==2:
p.backward(20)
if c==3:
p.up
p.forward(20)
if c==4:
p.down
p.forward
The random.choice
function raises the following error:
'builtin_function_or_method' object has no attribute 'choice'
Why does it raise the error and how can I solve the problem?
Aucun commentaire:
Enregistrer un commentaire