A. Write a triangle solver that takes 3 inputs consisting of angles in degrees and length
of sides in arbitrary units and, if possible (your program has to determine this),
supplies all other angles and side lengths. There will be either 0 triangles, 1 triangle,
2 triangles or an infinite number of triangles – you program must determine which
possibility. Classify the type of triangle (right triangle, isosceles, equilateral, acute,
obtuse – see any good geometry book. Finally, use the Turtle module to draw the
triangle(s) with correct relative dimensions.

The first paragraph here will help get you started:
http://docs.python.org/py3k/library/turtle.html

This will help understand triangles:
http://www.freemathhelp.com/feliz-angles-triangle.html

The key part is understanding that all triangles will have a total of 180* as the sum of all angles. That means, given your 3 inputs, if they don't add up to 180* then it's not a triangle.

You have a lot of choices on how to start. A better way for us to help you is to start writing some code, and when you have trouble or get stuck, then ask. Homework is meant for you to learn, not for people on a message board to do it for you.

import turtle
turtle.speed(0)

for i in range(52):
turtle.forward(100)
turtle.left(175)
turtle.forward(100)
turtle.left(90)
turtle.forward(10)
turtle.left(90)
turtle.right(2)

import turtle

def draw_triangle():
    window = turtle.Screen()
    window.bgcolor("green") #background color

    tom = turtle.Turtle()

    tom.forward(100) 
    tom.left(120)
    tom.forward(100)
    tom.left(120)
    tom.forward(100)

    window.exitonclick() #to exit 

draw_triangle()

Edited 1 Year Ago by Wadie

This question has already been answered. Start a new discussion instead.