Questions

How do you make a Triangle in Python?

Python provides a simple pen and a virtual canvas to draw shapes patterns drawings. All the functions of this pen and virtual canvas are contained in the turtle module of python. We can draw a triangle in python using the turtle module. For which we have to import the turtle module by using the import turtle command. 

Then we can use the required functions from the turtle module to draw a triangle as we wish.

For example:
                    

import turtle

canvas = turtle.Turtle()

canvas.forward(150) # draw base

canvas.left(120)

canvas.forward(150)

canvas.left(120)

canvas.forward(150)

turtle.done()

Related Questions

Related Topics

Share with friends

Customize your course in 30 seconds

Which class are you in?
5th
6th
7th
8th
9th
10th
11th
12th
Get ready for all-new Live Classes!
Now learn Live with India's best teachers. Join courses with the best schedule and enjoy fun and interactive classes.
tutor
tutor
Ashhar Firdausi
IIT Roorkee
Biology
tutor
tutor
Dr. Nazma Shaik
VTU
Chemistry
tutor
tutor
Gaurav Tiwari
APJAKTU
Physics
Get Started

Leave a Reply

avatar
  Subscribe  
Notify of

Customize your course in 30 seconds

Which class are you in?
No thanks.