+ 1

Shorter than this ??

Can this program be made more shorter for computing volume and area of circle ?? https://code.sololearn.com/c8f2N4UdS7LT/?ref=app

12th May 2017, 5:59 AM
xCalifier
xCalifier - avatar
3 Respostas
0
I don't know about python 2.7, but for python 3 you could do pi = 3.141592 rad = float(input()) print("Area of circle is ", (pi*rad*rad) ) Also, a circle doesn't have volume. A sphere would have volume but it's surface area formula isn't the one in the code. And I would recommend you not to do int(input()) but rather do float(input()) unless you want the radius to be explicitly an integer
12th May 2017, 7:00 AM
spcan
spcan - avatar
+ 5
For few chars less, you can spare the pi assignement: rad = float(input()) print("Area of circle is ", 3.141592*rad*rad )
12th May 2017, 8:00 AM
visph
visph - avatar
0
must use function overloading
12th May 2017, 9:05 AM
Reverse Leo😵
Reverse Leo😵 - avatar