Computer Science, asked by f2020266419, 5 months ago

Write a program that determines the name of a shape from its number of sides. Read the number of sides from the
user and then report the appropriate name as part of a meaningful message. Your program should support shapes
with anywhere from 3 up to (and including) 10 sides. If a number of sides outside of this range is entered then your
program should display an appropriate error message.

Answers

Answered by jai696
8

\large\mathsf\color{pink}{Solution\: using\: python\: 3}

def find_shape(sides):

if sides == 3:

return "triangle"

if sides == 4:

return "quadrilateral"

if sides == 5:

return "pentagon"

if sides == 6:

return "hexagon"

if sides == 7:

return "heptagon"

if sides == 8:

return "octagon"

if sides == 9:

return "nonagon"

if sides == 10:

return "decagon"

return "unsupported"

sides = int(input("enter no of sides: "))

print(f"The shape is {find_shape(sides)}.")

\large\mathsf\color{lightgreen}useful?\: \color{white}\longrightarrow\: \color{orange}brainliest!

Similar questions