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.

Recommended Answers

All 6 Replies

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)

Our friend ryantroop says it all!

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()

plz code me draw a turtle viral print plz create a program

Hi Viral

This is a web site for people who work with computers and want to learn more. If you want to learn how to write turtle code then start your own topic here and someone will help you. If you just want someone to do it for you then you have come to the wrong place - wo don't do people's homework for them.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.