Create a Google Chrome Logo using python turtle programming language | CodeHub

MNC Answers
0

 What is Turtle in Python

Turtle is like a drawing board in Python, which lets us command a turtle to draw over where we have insisted the direction like forward(), backward(), etc.



Create a Google Chrome Logo using python turtle programming language | CodeHub



How to use Turtle

1. We need to import the "Turtle" package

2. We have to create a turtle where we need to control 

3. Give direction to draw around using the turtle methods

4. Finally, run turtle.done()

Note:

You can install these libraries using pip command.

import the required package to draw the logo.

Turtle is pre-installed in mostly all programming software if Turtle is not  installed please use this pip command  pip install PythonTurtle 

Video Output:



Source Code:

from turtle import *


radius=120

#heading position -150 is opposite of 150 degree angle

setheading(-150)

penup()

#-Red shape of the Chrome Logo

color("red")

begin_fill()

forward(radius)

pendown()

right(90) #set the angle to 90

circle(-radius, 120)

#forward distance is equal to 180

forward(radius*3**.5)

left(120)

#draw the circle angle 120 and radius of 240

circle(2*radius, 120)

left(60)

forward(radius*3**.5)

end_fill()




left(180)

color("green")

begin_fill()

forward(radius*3**.5)

left(120)

circle(2*radius, 120)

left(60)

forward(radius*3**.5)

left(180)

circle(-radius, 120)



end_fill()




left(180)

circle(radius,120)

color("yellow")

begin_fill()

circle(radius, 120)

right(180)

forward(radius*3**.5)

right(60)

circle(-2*radius, 120)

right(120)

forward(radius*3**.5)

end_fill()




penup()

left(98)

forward(radius/20)

setheading(60)

color("blue")

pendown()

begin_fill()

circle(distance(0,0))

end_fill()

hideturtle()


done() (code-box)


output:

Create a Google Chrome Logo using python turtle programming language | CodeHub




F.A.Qs - 

1) What is Python ?

Python is a high-level, interpreted, general-purpose programming language. Its design philosophy emphasizes code readability with the use of significant indentation. Python is dynamically-typed and garbage-collected. Read more https://en.wikipedia.org/wiki/Python_...)


2) What is turtle / turtle graphics ?

Turtle graphics is a popular way for introducing programming to kids. It was part of the original Logo programming language developed by Wally Feurzeig, Seymour Papert and Cynthia Solomon in 1967. Read more https://docs.python.org/3/library/tur...

3) Which software is used to execute code ?

Visual studio code   

Post a Comment

0Comments
Post a Comment (0)

#buttons=(Accept !) #days=(20)

Our website uses cookies to enhance your experience. Learn More
Accept !
Youtube Channel Image
MM4Tech Subscribe To watch more Tutorials
Subscribe