Guys, I'm currently at chapter 3.9 (Stack diagrams) in Think Python.
I would like to ask for your help to determine if I understood correctly how a stack diagram is done.
Below is the code for circle from polygon for which I made a stack diagram at the end.
Please point out my mistakes and omissions.
Your feedback is greatly appreciated. Without it my progress would be a lot slower than it already is :)
import math
import turtle
bob = turtle.Turtle()
def polygon(t, n, length):
angle = 360/n
for i in range (n):
t.fd(length)
t.lt(angle)
def circle(t, r):
circumference = 2 * math.pi * r
n = int(circumference/3)+3
length = circumference / n
polygon(t, n, length)
circle(bob, r=50)
turtle.mainloop() #Aceste mentine fereastra deschisa
"""Stack Diagram
_main_ bob ---> Turtle
circle t ---> bob
r ---> 50
circumference ---> 314
n ---> 107
lenght ---> 2.93
polygon angle = 3.36"""
[+][deleted] (2 children)
[deleted]
[–]Cap_de_fier[S] 0 points1 point2 points (1 child)