Question: Write two functions, triangle ( ) and nestedTriangle ( ) . Both functions take two parameters: a turtle and an edge length. The pseudocode for

Write two functions, triangle() and nestedTriangle(). Both functions take two parameters: a turtle and an edge length. The pseudocode for triangle() is:
```
triangle(t, length):
1. If length >10:
Repeat 3 times:
Move t, the turtle, forward length steps.
Turn t left 120 degrees.
Call triangle with t and length/2.
```
The pseudocode for nestedTriangle() is very similar:
```
nestedTriangle(t, length):
1. If length >10:
Repeat 3 times:
Move t, the turtle, forward length steps.
Turn t left 120 degrees.
Call nestedTriangle with t and length/2.
```
A template program, nestingTrianges.py, is available here on GitHub. The grading script does not run the whole program, but instead tests your function separately ('unit tests') to determine correctness. As such, the function names must match exactly (else, the scripts cannot find it). Make sure to use the function names from the GitHub program (it is expecting triangle() and nestedTriangle()).
A sample run:
Enter edge length: 160
which would produce:
Write two functions, triangle ( ) and

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!