Search for question
Question

Q4 is_triangle, is_isosceles, is_equilateral

30 Points

Purpose: Use top-down design to implement an entire program.

In this problem, you will create a fuller version of your program from Problem 5.3. Start by

making a copy of your previous notebook, called triangle2.ipynb. Specifically, you will be

augmenting your program so that for each set of three numbers the user enters, it prints "Yes"

or "No" for each of the following: Is it a triangle? Is it isosceles? Is it equilateral?

Using a top-down approach:

a. Create pseudocode for the entire program. Hint: you may copy and edit the pseudocode at

the end of Problem 5.3.

b. (Modify your previous program to) implement the pseudocode, assuming that the functions

is_isosceles and is_equilateral exist. Add new comments.

c. Add two additional boolean functions: is_isosceles and is_equilateral. Each should take three

lengths as input. If the lengths make a valid triangle and at least two of them are equal, then it

is isosceles. If the lengths make a valid triangle and all three are equal, then it is equilateral.

Hint: you may is_triangle in either. Comment them.

d. Run your program on following inputs: 1, 1, 1; 1, 1, 2; 1, 1, 3; 1, 2, 3; and 2, 2, 3. Record the

output in comments in blocks at the end of your program.

Turn in: Your answers for (a)-(d) in the successive boxes below...

IMPORTANT NOTE: Points will be deducted for uncommented code.

Q4.1

5 Points

(a) Cut-and-paste of your pseudocode

Fig: 1