Friday, August 7, 2020

Middle School Mathematics, Understanding Polygons - [FREE CODE]

*****
This program will tell you all about the Angles of the selected Polygon when you enter the ratio of its sides.
***** 

a = input("Enter polygon : ")

if a.lower() == "triangle":

    b = int(input("Enter  ratio of first angle : "))

    c = int(input("Enter ratio of second angle : "))

    d = int(input("Enter ratio of third angle : "))

    e = b + c + d

    f = 180 / e

    g = b * f

    h = c * f

    i = d * f

    print("Angles of the",a,"are",round(g),round(h),"and",round(i))

elif a.lower() == "quadrilateral":

    b = int(input("Enter  ratio of first angle : "))

    c = int(input("Enter  ratio of second angle : "))

    d = int(input("Enter  ratio of third angle : "))

    e = int(input("Enter  ratio of fourth angle : "))

    v = b + c + d + e

    w = 360 / v

    m = b * w

    n = c * w

    o = d * w

    p = e * w

    print("Angles of the",a,"are",round(m),round(n),round(o),"and",round(p))

elif a.lower() == "pentagon":

    b = int(input("Enter  ratio of first angle : "))

    c = int(input("Enter  ratio of second angle : "))

    d = int(input("Enter  ratio of third angle : "))

    e = int(input("Enter  ratio of fourth angle : "))

    f = int(input("Enter  ratio of fifth angle : "))

    v = b + c + d + e + f

    w = 540/ v

    m = b * w

    n = c * w

    o = d * w

    p = e * w

    q = f * w

    print("Angles of the", a, "are", round(m), round(n), round(o),round(p),"and",round(q))

elif a.lower() == "hexagon":

    b = int(input("Enter  ratio of first angle : "))

    c = int(input("Enter  ratio of second angle : "))

    d = int(input("Enter  ratio of third angle : "))

    e = int(input("Enter  ratio of fourth angle: "))

    f = int(input("Enter  ratio of fifth angle : "))

    g = int(input("Enter  ratio of sixth angle : "))

    v = b + c + d + e + f + g

    w = 720 / v

    m = b * w

    n = c * w

    o = d * w

    p = e * w

    q = f * w

    r = g * w

    print("Angles of the", a, "are", round(m), round(n), round(o), round(p),round(q),"and",round(r))

elif a.lower() == "heptagon":

    b = int(input("Enter  ratio of first angle : "))

    c = int(input("Enter  ratio of second angle : "))

    d = int(input("Enter  ratio of third angle : "))

    e = int(input("Enter  ratio of fourth angle : "))

    f = int(input("Enter  ratio of fifth angle : "))

    g = int(input("Enter  ratio of sixth angle : "))

    h = int(input("Enter  ratio of seventh angle : "))

    v = b + c + d + e + f + g + h

    w = 900 / v

    m = b * w

    n = c * w

    o = d * w

    p = e * w

    q = f * w

    r = g * w

    s = h * w

    print("Angles of the", a, "are", round(m), round(n), round(o), round(p), round(q),round(r),"and",round(s))

elif a.lower() == "octagon":

    b = int(input("Enter  ratio of first angle : "))

    c = int(input("Enter  ratio of second angle : "))

    d = int(input("Enter  ratio of third angle : "))

    e = int(input("Enter  ratio of fourth angle : "))

    f = int(input("Enter  ratio of fifth angle : "))

    g = int(input("Enter  ratio of sixth angle : "))

    h = int(input("Enter  ratio of seventh angle : "))

   i = int(input("Enter  ratio of eighth angle : "))



    v = b + c + d + e + f + g + h + i

    w = 1080 / v

    m = b * w

    n = c * w

    o = d * w

    p = e * w

    q = f * w

    r = g * w

    s = h * w

    t = i * w

    print("Angles of the", a, "are", round(m), round(n), round(o), round(p), round(q), round(r),round(s), "and",round(t))

elif a.lower() == "nonagon":

    b = int(input("Enter  ratio of first angle : "))

    c = int(input("Enter  ratio of second angle : "))

    d = int(input("Enter  ratio of third angle : "))

    e = int(input("Enter  ratio of fourth angle : "))

    f = int(input("Enter  ratio of fifth angle : "))

    g = int(input("Enter  ratio of sixth angle : "))

    h = int(input("Enter  ratio of seventh angle : "))

   i = int(input("Enter  ratio of eighth angle : "))

  j= int(input("Enter  ratio of ninth angle : "))



    j = int(input("Enter ninth ratio : "))

    v = b + c + d + e + f + g + h + i + j

    w = 1260/ v

    m = b * w

    n = c * w

    o = d * w

    p = e * w

    q = f * w

    r = g * w

    s = h * w

    t = i * w

    u = j * w

    print("Angles of the", a, "are", round(m), round(n), round(o), round(p), round(q), round(r), round(s),

          round(t),"and",round(u))

elif a.lower() == "decagon":

   b = int(input("Enter  ratio of first angle : "))

    c = int(input("Enter  ratio of second angle : "))

    d = int(input("Enter  ratio of third angle : "))

    e = int(input("Enter  ratio of fourth angle : "))

    f = int(input("Enter  ratio of fifth angle : "))

    g = int(input("Enter  ratio of sixth angle : "))

    h = int(input("Enter  ratio of seventh angle : "))

   i = int(input("Enter  ratio of eighth angle : "))

  j= int(input("Enter  ratio of ninth angle : "))

 k= int(input("Enter  ratio of tenth angle : "))



    v = b + c + d + e + f + g + h + i + j + k

    w = 1440/ v

    m = b * w

    n = c * w

    o = d * w

    p = e * w

    q = f * w

    r = g * w

    s = h * w

    t = i * w

    u = j * w

    l = k * w

    print("Angles of the", a, "are", round(m), round(n), round(o), round(p), round(q), round(r), round(s),

          round(t),round(u),"and",round(l))

else:

    print("Enter Correct Value Please")