Python Turtle - Code a Square Tutorial

Veröffentlicht am: 23 Februar 2020
auf dem Kanal: Geek Tutorials
21,330
143

Learn how to quickly draw 3 different squares using Python's Turtle module.

⭐ Kite is a free AI-powered coding assistant that will help you code faster and smarter. The Kite plugin integrates with all the top editors and IDEs to give you smart completions and documentation while you’re typing. I've been using Kite for 6 months and I love it! https://www.kite.com/get-kite/?utm_me...

~ CODE ~

from turtle import *

speed(0)
bgcolor("black")

Outlined Square
penup()
goto(-350, 100)
pendown()
pensize(5)
color("magenta")

for i in range(4):
forward(150)
left(90)

Multi-Coloured Square (Stroke only)
penup()
goto(-175, 100)
pendown()

for i in ["yellow", "red", "blue", "purple"]:
color(i)
forward(150)
left(90)

Square with Fill and Stroke
penup()
goto(0, 100)
color("orange", "yellow")
pendown()
begin_fill()

for i in range(4):
forward(150)
left(90)
end_fill()

hideturtle()

exitonclick()


Auf dieser Seite können Sie das Online-Video Python Turtle - Code a Square Tutorial mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Geek Tutorials 23 Februar 2020 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 21,330 Mal angesehen und es wurde von 143 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!