+ 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
3 ответов
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
+ 5
For few chars less, you can spare the pi assignement:
rad = float(input())
print("Area of circle is ", 3.141592*rad*rad )
0
must use function overloading