Only the middle of the star is not painted in Python Turtle.

Asked 2 years ago, Updated 2 years ago, 124 views

Hello, I'm a college student taking Python as a seasonal semester. We're drawing a star with a turtleneck inside the river, but it doesn't paint in the middle of the star. How do I fix the code? I'd really appreciate it if you let me know!

import turtle

t=turtle.Turtle()
t.shape("turtle")
turtle.bgcolor("black")

import random

clist=["#d4c1cf","blue","green","#8affd4","#ff19c6","purple","#ff19c6"]
j=0
p=0

while j<20:
    x = random.randint(-200, 190)
    y = random.randint(-200, 190)
    rancolor = random.choice(clist)
    t.pencolor(rancolor)
    t.fillcolor(rancolor)
    length = random.randint(10, 100)
    t.begin_fill()
    for p in range (5):
        t.forward(length)
        t.right(144)
    t.end_fill()
    t.penup()
    t.goto(x,y)
    j=j+1

python turtle

2022-09-20 11:34

1 Answers

Please upload the code in text format.

I think we need to draw the stars a little bit more complicatedly, just along the outer edges.


t.fillcolor("blue")
t.begin_fill()
for _ in range(5):
    t.forward(l)
    t.left(36)
    t.backward(l)
    t.right(108)
t.end_fill()


2022-09-20 11:34

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.