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()
In questa pagina del sito puoi guardare il video online Draw A Rainbow(Python Programming) della durata di ore minuti seconda in buona qualità , che l'utente ha caricato PythonLove 28 gennaio 2024, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 587 volte e gli è piaciuto 9 spettatori. Buona visione!