import turtle
from math import sqrt, asin Square Root Spiral in Python
import math as math
import random OUTPUT:
t= turtle.Turtle()
t.pensize(2)
times= int(input("How many times do u want it to repeat? "))
size= int(input("How big do u want it to be [choose between 10-70] "))
sides=[ ]
#intial side values of 1st triangle
x= 1
y= 1
c= math.sqrt((x**2)+(y**2))
colors= ["gold", "orange", 'red', "maroon", "violet", "magenta", "purple", "navy", "blue", "skyblue", "cyan", "turquoise", "lightgreen", "green", "darkgreen",
"chocolate", "brown", "black", "gray"]
color= random.choice(colors)
t.pencolor(color)
t.forward(size*x) #size
t.left(90)
CONSOLE:
for i in range(times):
#append side values to list
sides.append((round(x, 3), y, round(c, 3)))
#choose random color
color= random.choice(colors)
t.pencolor(color)
t.forward(size*y) #size
p=t.pos() #p is the current position of turtle
#finding unkown angle value of triangle
a1= math.asin(x/c) #radian
b= math.degrees(a1) #convert radian to degree
a2= 180-b #degree of rotation
t.left(a2)
#choose random color
color= random.choice(colors)
t.pencolor(color)
t.forward(size*c) #size
t.penup()
t.goto(p)
t.right(90)
x=c
c= math.sqrt((x**2)+(y**2))
t.pendown()
#choose random color
color= random.choice(colors)
t.pencolor(color)
#print triangle values
print("\nSide Values of...\n")
r=1
for n in sides:
print("Triangle {}:".format(r), n)
print()
r+=1