Ask Question
18 July, 01:00

In Python, create a calculator that will ask the user to input a single dimension of a shape and then display its properties.

E. g. Enter the radius of a circle; Display the circle's Diameter, Circumference and Area

Only done for square and circle.

+2
Answers (1)
  1. 18 July, 01:20
    0
    The code is given in the explanation section.

    Explanation:

    def areacalcpy ():

    _input_ = input ("Enter the shape that you wish to calculate the area: ")

    shapearea = 0

    pieval = 3.14

    if _input_ = = "Square":

    sideval = int (input ("Enter side value of the shape: "))

    shapearea = shapearea + (sideval * * 2)

    elif _input_ = = "Circle":

    circleradius = int (input ("Enter radius value of the circle: "))

    shapearea = shapearea + (2 * pieval * circleradius)

    else:

    print ("The given shape is invalid, give a valid shape to calculate area")

    print ("%.2f" % shapearea)

    areacalcpy ()

    The given code can calculate the area for both the shapes circle and square.

    Similarly the area can be calculated for triangle and rectangle.
Know the Answer?
Not Sure About the Answer?
Find an answer to your question 👍 “In Python, create a calculator that will ask the user to input a single dimension of a shape and then display its properties. E. g. Enter ...” in 📗 Computers & Technology if the answers seem to be not correct or there’s no answer. Try a smart search to find answers to similar questions.
Search for Other Answers