Python Program Triangle Using Turtle




Python Program Triangle Using Turtle

  • Turtle is a Python feature like a drawing board.
  • Turtle is a special feathers of Python.
  • You can use functions like turtle.forword (....) and turtle.left(....) which can move      the turtle around the board.
  • These are Python Turtle project, you are going to draw a  Triangle.

Installation

pip install pythonturtle

or

sudo pip install pythonturtle

The First step is to import libraries

import turtle

or 

from turtle import *


Triangle.py


 import turtle 
 wn = turtle.Screen()
 wn.bgcolor("black")
 skk = turtle.Turtle()
 skk.color("orange")

 def sqrfunc(size):
	 for i in range(4):
		 skk.fd(size)
		 skk.left(120)
		 size = size + 5

 sqrfunc(6)
 sqrfunc(26)
 sqrfunc(46)
 sqrfunc(66)
 sqrfunc(86)
 sqrfunc(106)
 sqrfunc(126)
 sqrfunc(146)
 sqrfunc(166)
 sqrfunc(186)
 sqrfunc(206)