Teaching Kids Programming: Videos on Data Structures and Algorithms
What we have learned today:
The sum of total interior angles of a N-sided polygon (where N is larger or equal to 3) is:
Because we can partition a simple polygon (convex or concave, non self intersecting and no holes) into (n-2) triangles.
To draw a star, we can do this in LOGO:
repeat 5 [fd 100 rt 144]
The “100” is the length of the longest edge of the star. Or we can import the turtle graphics library:
1 2 3 4 5 6 | from turtle import fd, rt def star(N): for _ in range(5): fd(N) rt(144) |
from turtle import fd, rt def star(N): for _ in range(5): fd(N) rt(144)
–EOF (The Ultimate Computing & Technology Blog) —
GD Star Rating
loading...
259 wordsloading...
Last Post: Teaching Kids Programming - Probability of Rolling a Dice: Strictly Increasing Order One After Another
Next Post: Teaching Kids Programming - Check if a String is Prefix/Suffix in Python (Two Pointer Algorithm)