Ask Question
18 January, 00:39

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 January, 03:44
    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 and Technology if you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers