From 0b71c96e5f12208b377cc9fc8b5181259c7a4c5c Mon Sep 17 00:00:00 2001 From: Akash Kumar Karmaker <101138706+Akash0239@users.noreply.github.com> Date: Fri, 11 Oct 2024 20:31:44 +0600 Subject: [PATCH] Create rainbow.py --- Python/rainbow.py | 51 +++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Python/rainbow.py diff --git a/Python/rainbow.py b/Python/rainbow.py new file mode 100644 index 0000000..d1030f0 --- /dev/null +++ b/Python/rainbow.py @@ -0,0 +1,51 @@ +import turtle + +sc = turtle.Screen() + + +pen = turtle.Turtle() + +def semi_circle(col, rad, val): + + + pen.color(col) + + + pen.circle(rad, -180) + + + pen.up() + + + pen.setpos(val, 0) + + + pen.down() + + pen.right(180) + + +# Set the colors for drawing +col = ['violet', 'indigo', 'blue', + 'green', 'yellow', 'orange', 'red'] + +# Setup the screen features +sc.setup(600, 600) + +# Set the screen color to black +sc.bgcolor('black') + + +pen.right(90) +pen.width(20) +pen.speed(7) + +# Loop to draw 7 semicircles +for i in range(7): + semi_circle(col[i], 10*( + i + 8), -10*(i + 1)) + +# Hide the turtle +pen.hideturtle() + +sc.mainloop()