How to draw Bike using Python Turtle

Day 3 | Project 3

Code With Nick

Hello there.

In this quick tutorial, I’ll show you how to draw Bike using Python Turtle. It’s simple, it’s fast, and it’s easy.



How to Draw Bike using Python Turtle 

Copy this code and run this in your system. I hope this project will be helpful and easy to understand for you.

Python code to draw Bike:

#python code to draw Bike 
#using Turtle
 #@code_with.nick

import turtle

# Create a turtle object
bike = turtle.Turtle()

# Set the background color and pen color
turtle.bgcolor("light blue")
bike.pencolor("black")

# Draw the frame of the bike
bike.left(30)
bike.forward(100)
bike.right(60)
bike.forward(50)
bike.right(60)
bike.forward(50)
bike.right(60)
bike.forward(50)
bike.right(120)
bike.forward(50)
bike.right(60)
bike.forward(50)
bike.right(60)
bike.forward(100)

# Draw the wheels
bike.penup()
bike.goto(50, -50)
bike.pendown()
bike.circle(50)
bike.penup()
bike.goto(250, -50)
bike.pendown()
bike.circle(50)

# Draw the handlebars
bike.penup()
bike.goto(125, 50)
bike.pendown()
bike.left(60)
bike.forward(50)
bike.right(120)
bike.forward(50)

# Hide the turtle cursor
bike.hideturtle()

# Keep the window open until it is closed manually
turtle.done()



That's all. The code is complete. Use this code to challenge yourself. Make changes in this code and create your own project.
Thanks for reading.

Comments

Popular posts from this blog

How to make screensaver using Python Turtle