This is a short video on how to draw a rainbow with or in python Programming language. The short tutorial showcases the python code in few lines. The module used is turtle.
The python tutorial is short and easy to understand. Here is the approach:
Import Turtle.
Set screen
Make Turtle Object
Define colors used for drawing
Loop to draw semi-circles oriented by 180-degree position.
The code:
import turtle
mypen= turtle.Turtle()
mypen.shape('turtle')
mypen.speed(10)
window= turtle.Screen()
window.bgcolor('white')
rainbow= ['red','orange','yellow','green','blue','indigo','violet']
size= 180
mypen.penup()
mypen.goto(0,-180)
for color in rainbow:
mypen.color(color)
mypen.fillcolor(color)
mypen.begin_fill()
mypen.circle(size)
mypen.end_fill()
size-=20
turtle.done()
Nesta página do site você pode assistir ao vídeo on-line Draw A Rainbow(Python Programming) duração hora minuto segundo em boa qualidade , que foi baixado pelo usuário PythonLove 28 Janeiro 2024, compartilhe o link com seus amigos e conhecidos, no youtube este vídeo já foi visto 587 vezes e gostou 9 espectadores. Boa visualização!