Advertisement
Guest User

Untitled

a guest
Feb 23rd, 2017
94
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.25 KB | None | 0 0
  1. from turtle import *
  2. Type = input("Input the type of triangle, E(Equilateral), I(Isosceles), S(Scalene): ").upper()
  3. x = int(input("Enter the x coordinate position for the triangle: "))
  4. y = int(input("Enter the y coordinate position for the triangle: "))
  5.  
  6. if Type == "E":
  7.     s1 = int(input("Input the length of the triangle's initial side, the other sides will be drawn to equal length: "))
  8.     s2 = s1
  9.     s3 = s1
  10.  
  11.     t = Turtle()
  12.     t.penup()
  13.     t.hideturtle()
  14.     t.setx(x)
  15.     t.sety(y)
  16.     t.pendown()
  17.     t.forward(s1)
  18.     t.left(120)
  19.     t.forward(s2)
  20.     t.left(120)
  21.     t.forward(s3)
  22.     t.left(120)
  23.    
  24. elif Type == "I":
  25.     s1 = int(input("Input the length of the 2 equal sides: "))
  26.     s2 = s1
  27.     s3 = int(input("Input the length of the last side of the triangle : "))
  28.  
  29.     t = Turtle()
  30.     t.penup()
  31.     t.hideturtle()
  32.     t.setx(x)
  33.     t.sety(y)
  34.     t.pendown()
  35.    
  36.    
  37.  
  38. elif Type == "S":
  39.     sides = int(input("Enter the length of all 3 sides seperated with a space: "))
  40.     s1, s2, s3 = sides.split(" ")
  41.  
  42.     t = Turtle()
  43.     t.penup()
  44.     t.hideturtle()
  45.     t.setx(x)
  46.     t.sety(y)
  47.     t.pendown()
  48.    
  49.  
  50. else:
  51.     print("Invalid input for your triangle,  please close the program and reopen it")
  52.     quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement