Search This Blog
hello everyone myself Jasskeerat singh and I will post my blogs and learn blogging
Featured
- Get link
- X
- Other Apps
MY FIRST PYTHON PROJECT (TURTLE RACE)
HELLO EVERYONE I AM BACK AND THIS BLOG I WILL BE SHARING UP MY FIRST PYTHON PROJECT WHICH I MADE YOU CAN JUST COPY PASTE IT .LINK TO DOWNLOAD PYTHON :-https://www.python.org/
TO INSTALL VISUAL STUDIO CODE(VS CODE) :- https://code.visualstudio.com/download
SOURCE CODE:-
import time
import turtle
from turtle import Turtle
from random import randint
#window setup
window=turtle.Screen()
window.title("TURTLE RACE")
turtle.bgcolor("green")
turtle.color("white")
turtle.speed(0)
turtle.penup()
turtle.setpos(-140,200)
turtle.write("TURTLE RACE",font=("Ravie", 30,"bold"))
turtle.penup()
#dirt
turtle.setpos(-400, -180)
turtle.color("orange")
turtle.begin_fill()
turtle.pendown()
turtle.forward(800)
turtle.right(90)
turtle.forward(300)
turtle.right(90)
turtle.forward(800)
turtle.right(90)
turtle.forward(300)
turtle.end_fill()
stamp_size = 20
square_size = 15
finish_line = 300
turtle.color("black")
turtle.shape("square")
turtle.shapesize(square_size / stamp_size )
turtle.penup()
for i in range(10):
turtle.setpos(finish_line, (150 - (i * square_size * 2 )))
turtle.stamp()
for j in range(10):
turtle.setpos(finish_line + square_size,((150 - square_size) - (j * square_size * 2)))
turtle.stamp()
turtle.hideturtle()
#turtle 1
turtle1=Turtle()
turtle1.speed(3)
turtle1.color("orange")
turtle1.shapesize(1.25)
turtle1.shape("turtle")
turtle1.penup()
turtle1.goto(-300, 150)
turtle1.pendown()
#turtle 2
turtle2=Turtle()
turtle2.speed(4)
turtle2.color("cyan")
turtle2.shapesize(1.25)
turtle2.shape("turtle")
turtle2.penup()
turtle2.goto(-300, 100)
turtle2.pendown()
#turtle 3
turtle3=Turtle()
turtle3.speed(4)
turtle3.write("half race",font=("Ariel",10,"bold"))
turtle3.color("magenta")
turtle3.shapesize(1.25)
turtle3.shape("turtle")
turtle3.penup()
turtle3.goto(-300, 50)
turtle3.pendown()
#turtle 4
turtle4=Turtle()
turtle4.speed(2)
turtle4.color("red")
turtle4.shapesize(1.25)
turtle4.shape("turtle")
turtle4.penup()
turtle4.goto(-300,0)
turtle4.pendown()
#turtle 5
turtle5=Turtle()
turtle5.speed(3)
turtle5.color("white")
turtle5.shapesize(1.25)
turtle5.shape("turtle")
turtle5.penup()
turtle5.goto(-300,-50)
turtle5.pendown()
time.sleep(1)
for i in range(193):
turtle1.forward(randint(1,5))
turtle2.forward(randint(1,5))
turtle3.forward(randint(1,5))
turtle4.forward(randint(1,5))
turtle5.forward(randint(1,5))
turtle.exitonclick()
I HOPE YOU ALL WILL TRY THIS AND IT HOPE FULLY WORK FOR YOU AND IF IT DOESN'T WORKS PLEASE COMMENT DOWN.THANK YOU EVERYONE
- Get link
- X
- Other Apps
Comments
PLEASE GIVE ME SOME IDEAS FOR MY NEXT BLOG
ReplyDeleteyou should upload some more python projects
ReplyDeletethanks for your advise
Deletewelcome
Delete