Python Program to Calculate Area & Volume of Sphere
This python program calculates area and volume of sphere whose radius is given by user.
This program uses following formula for area and volume of sphere:
Area = 4πr2
Python Source Code: Sphere Area & Volume Calculator
# Finding area and volume of sphere # importing math module for PI import math # Reading temperature in Celsius radius = float(input('Enter radius of circle: ')) # Calculating area and volume area = 4 * math.pi * radius ** 2 volume = (4/3) * math.pi * radius**3 # Displaying output print('Area = %0.4f.' % (area)) print('Volume = %0.4f.' % (volume))
Python Area & Volume of Sphere Output
Enter radius of circle: 5 Area = 314.1593. Volume = 523.5988.