Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from turtle import *
- Type = input("Input the type of triangle, E(Equilateral), I(Isosceles), S(Scalene): ").upper()
- x = int(input("Enter the x coordinate position for the triangle: "))
- y = int(input("Enter the y coordinate position for the triangle: "))
- if Type == "E":
- s1 = int(input("Input the length of the triangle's initial side, the other sides will be drawn to equal length: "))
- s2 = s1
- s3 = s1
- t = Turtle()
- t.penup()
- t.hideturtle()
- t.setx(x)
- t.sety(y)
- t.pendown()
- t.forward(s1)
- t.left(120)
- t.forward(s2)
- t.left(120)
- t.forward(s3)
- t.left(120)
- elif Type == "I":
- s1 = int(input("Input the length of the 2 equal sides: "))
- s2 = s1
- s3 = int(input("Input the length of the last side of the triangle : "))
- t = Turtle()
- t.penup()
- t.hideturtle()
- t.setx(x)
- t.sety(y)
- t.pendown()
- elif Type == "S":
- sides = int(input("Enter the length of all 3 sides seperated with a space: "))
- s1, s2, s3 = sides.split(" ")
- t = Turtle()
- t.penup()
- t.hideturtle()
- t.setx(x)
- t.sety(y)
- t.pendown()
- else:
- print("Invalid input for your triangle, please close the program and reopen it")
- quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement