In this we are going to see a basic program to draw fibonacci spiral drawing of curve using turtle in Python Programming Language.
import turtle
import math
def curve(n):
a = 0
b = 1
y.penup()
y.setposition(factor, 0)
y.seth(0)
y.pendown()
y.pencolor("blue")
y.right(90)
for i in range(n):
print(b)
forward = math.pi * b * factor / 2
forward /= 90
for j in range(90):
y.forward(forward)
y.right(1)
temp = a
a = b
b = temp + b
factor = 5
n = int(input('Enter the no. of iterations: '))
print("Fibonacci series for", n, "elements :")
y = turtle.Turtle()
y.speed(900)
curve(n)
turtle.done()
# Coded by Shreya Idate
#ENJOY CODING
Post a Comment
FOR ANY DOUBTS AND ERRORS FEEL FREE TO ASK. YOUR DOUBTS WILL BE ADDRESSED ASAP