Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

python turtle sierpinski triangle

from turtle import *

speed(0) # set penspeed
left(90) # start position

def triangle(size, order):
    if order == 0:
        return
    for i in range(3):
        forward(size)
        triangle(size/2, order - 1) # recursive function
        backward(size)
        left(120)
 
triangle(100, 5) # test sierpinski triangle

done()
Comment

PREVIOUS NEXT
Code Example
Python :: how to order ints from greatest to least python 
Python :: python print list with newline 
Python :: pandas plot disable legend 
Python :: matplotlib x axis at the top 
Python :: pyspark session 
Python :: determinant of a matrix in python 
Python :: python process id 
Python :: how to get all the files in a directory in python 
Python :: python print version python 
Python :: how to rotate x axis labels in subplots 
Python :: django filter not null 
Python :: how to concat csv files python 
Python :: python module for converting miles to km 
Python :: pytorch open image 
Python :: how to make otp generator in python 
Python :: rotate labels matplotlib 
Python :: python discord discord.py disable remove help command 
Python :: python3.9 venv returned non-zero exit status 1 
Python :: python - sort dictionary by value 
Python :: how to enable matplotlib in notebook 
Python :: age calculator in python 
Python :: create folders in python 
Python :: the day before today python datetime 
Python :: python parser txt to excel 
Python :: pandas split by space 
Python :: pandas dataframe hist title 
Python :: print(DATA.popitem()) 
Python :: download maninder in python gui 
Python :: python input with space 
Python :: how to remove first few characters from string in python 
ADD CONTENT
Topic
Content
Source link
Name
7+1 =