Ā Build a Stopwatch using PYTHON
Stopwatch Using Python Today we will learn to make a stopwatch step by step, we all need a stopwatch at a party, so why not make one by coding it…
Stopwatch Using Python Today we will learn to make a stopwatch step by step, we all need a stopwatch at a party, so why not make one by coding it…
Python Projects For Resume Today we will create 5 Python projects for our resume which plays a very important role in our life, So let's start making step by step…
Scientific Calculator With Python Hey coder!!! In this article we will explain step by step how to create Scientific Calculator in Python , using the tinker library of Python. We…
Draw Square in Turtle Python Hello coders! Today we will learn to draw a square from Turtle model in Python step by step, so let's start our project Draw Square…
Chatbot Using Python Step by Step Guide Today we are going to make a chatbot with the help of Python, so let's learn step by step about it in an…
Draw Spiderman In Python Hello Coders! In this Project Draw Spiderman In Python ,Today we are learn to Draw Spiderman In Python Step by Step with source code. We all…
How to Build a Billing System ProjectĀ in Python using Tkinter in Python | Python Project Hello coder, welcome to the codewithrandom blog. In this blog, we will learn how to…
So our curious minds are you ready to create a Phonebook using Python? Hello, coders, welcome to the codewithrandom blog. Creating a phone book using Python is a great project…
Hey coder ! Are you excited for this diwali ? Let’s come with us to celebrating and wishing your friends and family through this Python code , So let’s go and start this code in easy to learn wayĀ , So this year wishing you with this interesting program. now, i have created a Diwali wishing program in python using turtle, in this I have used firework, bomb, text animation in this project.
You all try this code and run the wish code and show it to your friends and wish in a new way.
You all try this code and run the wishing program and show it to your friends and wish in a new way.
How to Prediction the Gender Using Python
import turtle
t = turtle.Turtle()
turtle.Screen().setup(500, 550)
turtle.Screen().bgcolor('black')
# Draw the outer shape for the diya
t.pencolor('blue')
t.fillcolor('orange')
t.begin_fill()
t.pensize(8)
t.speed(10)
t.right(60)
t.forward(200)
t.goto(0, 0)
t.right(60)
t.forward(200)
t.left(80)
t.circle(160, 78)
t.end_fill()
First, I imported the turtle using the import turtle function and then forwarded it.
1. Output Preview :Ā
# Function to set the position of the turtle
def set_position(x, y):
t.penup()
t.goto(x, y)
t.pendown()
# Draw the first curve inside the diya
t.pensize(10)
set_position(-25, -40)
t.right(60)
t.circle(60, 48)
# Draw the second curve inside the diya
set_position(-43, -70)
t.right(60)
t.circle(75, 68)
# Draw the circle in the center of the diya
set_position(15, -170)
t.pensize(8)
t.circle(30)
Using this code, I set the position of the lamp, then curved the design of the lamp, set_position(15, -170) This function sets the position of the turtle.Ā Ā
2. Output Preview :
# Function to draw a star
def star():
t.pensize(2)
t.pencolor('red')
t.fillcolor('yellow')
t.begin_fill()
for i in range(5):
t.forward(30)
t.right(144)
t.end_fill()
t.pensize(10)
t.pencolor('red')
# Function to draw a star connected to a curve
def curly_star(setheading, circle_x, circle_y):
set_position(0, 10)
t.setheading(setheading)
t.circle(circle_x, circle_y)
star()
# Function to draw a star connected to a straight line
def straight_star(setheading, forward):
set_position(0, 10)
t.setheading(setheading)
t.forward(forward)
star()
# Draw a series of stars in a curly pattern
curly_star(145, 75, 60)
curly_star(120, 150, 60)
curly_star(95, 200, 60)
# Draw a straight star
straight_star(90, 200)
# Draw a series of stars in a curly pattern in the opposite direction
curly_star(85, -200, 60)
curly_star(60, -150, 60)
curly_star(35, -75, 60)
In this line of code we have combined the curve designs by doing this line of code and then made a star. Def star(): This function creates a 5 pointed star by using the function set_position(0, 10) and then combined the { star. Def straight_star (setheading, forward): } Function to draw the star in a straight line,Ā step up to project.
3. Output Preview :
# Function to draw a firework pattern
def draw_firework(x, y):
t.penup()
t.goto(x, y)
t.pendown()
for _ in range(36):
t.color("orange")
t.forward(50)
t.right(170)
# Set up the turtle for drawing fireworks
t = turtle.Turtle()
turtle.Screen().bgcolor('black')
t.speed(10)
# Draw fireworks in each corner
draw_firework(-200, 200)
draw_firework(200, 200)
draw_firework(-200, -200)
draw_firework(200, -200)
# Hide the turtle
t.hideturtle()
# Finish drawing
turtle.done()
draw_firework() This line of code represents the firework and selects the color of the firework, then this turtle.Screen().bgcolor(‘black’) function sets the background color of our program t.hideturtle() This function is used to hide turtle after the program runs and you must try it.
How to Create a Restaurant Management System Using Python Hello coder, welcome to the codewithrandom blog. In this blog, we will learn how to build a Restaurant Management System Using…