+ 4
Why doesn’t this code work?
import turtle from turtle import * turtle.title("rainbow spiral") speed(15) bgcolor("black") r,g,b=255,0,0 for i in range(255*2): colormode(255) if i<255//3: g+=3 elif i<255*2//3: r-=3 elif i<255: b+=3 elif i<255*4//3: g-=3 elif i<255*5//3: r+=3 else: b-=3 fd(50+i) rt(91) pencolor(r,g,b) done()
18 odpowiedzi
+ 3
Do you have an error when you run the code or is it not drawing the shape you are expecting, please add more details. What are you trying to draw?
+ 2
turtle just doesnt work in sololearn sorry bud..
+ 2
dawit belachew , try this in my code.
import turtle
t=turtle.Turtle()
s=turtle.Screen()
t.speed(10) # not 100 max = 0
s.bgcolor("black") #debug
for i in range(240):
t.color("yellow")
t.circle(i)
t.left(5)
t.done() #debug
+ 1
Run my code, double click on the "code" button and paste your code with my corrections into the field ☺️
from turtle import Turtle, Screen
Screen().setup(360,360)
Screen().bgcolor("black")
turtle = Turtle()
turtle.shape("turtle")
turtle.speed(15)
r,g,b=255,0,0
for i in range(255*2):
turtle.color("red")
if i<255//3:
g+=3
elif i<255*2//3:
r-=3
elif i<255:
b+=3
elif i<255*4//3:
g-=3
elif i<255*5//3:
r+=3
else:
b-=3
turtle.forward(50+i)
turtle.right(91)
turtle.pencolor(r,g,b)
turtle.done()
https://code.sololearn.com/WpuWX7fi9doO/?ref=app
https://www.sololearn.com/post/1469146/?ref=app
0
Im trying to draw a rainbow spiral
0
What does it work on dutch guy?
0
i have an app called pydroid 3 and it works on that so ye
0
The app doesnt show on mobile
0
do you have an apple phone bc i have an samsung so maybe its bc of that
0
Yes
0
I have a desktop too
0
oh on desktop its visual studio code, the python ide and any other
0
import turtle
t=turtle.Turtle()
t.speed(100)
turtle.bgcolor("black")
for i in range(240):
t.color("yellow")
t.circle(i)
t.left(5)
turtle.done
This code isn't working for me
Python
0
Turtles don't work..... dk abt others...bit not working fr me...
0
Okay I will
0
I tried it but it doesn’t work
0
It says there is a problem in the line 3 the import turtle command
0
dawit belachew, I don't know what you are doing, but your code with my fixes works fine in my "turtle Heart" code.