Please can anybody help me to make a calculator for finding area of different shape. And my python version is 3.2.

Recommended Answers

All 4 Replies

Does "shape" also include a dodecahedron?
We cannot decide for you how complex this program has to be, so what have you tried to do for yourself?

The shapes can be triangle, square and rectangle.

Oh, come on.
Don't demand us to find out what the task is, then solve it.

If you cannot answer your own question by using paper and pencil, then you cannot solve it in python either...

First ask the user what shape is wanted ...
shape = input("What shape do you want (triangle, square and rectangle): ")
Once the shape is given, follow it with a conditional statement like ...

if shape == "rectangle":
    a = float(input("Enter length of side a: "))
    b = float(input("Enter length of side b: "))
    # now do your area calculation and show result

You could use a function for the area calculation and pass arguments a and b to this function and return the area from the function.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.