;

Python Program to Calculate the Volume and Surface Area of the Sphere


Tutorialsrack 13/05/2020 Python

In this python program, we will learn how to calculate the volume and surface area of the sphere.

What is the Sphere?

A sphere is a geometrical object in three-dimensional space that is the surface of a ball. Like a circle in a two-dimensional space, a sphere is defined mathematically as the set of points that are all at the same distance r from a given point, but in a three-dimensional space. 

Formula

Where r is the radius of the sphere.

Here is the source code of the program to calculate the volume and surface area of the sphere.

Python Program to Calculate the Volume and Surface Area of the Sphere
# Python Program to Calculate the Volume and Surface Area of the Sphere

# Declare the Value of PI
PI = 3.14

# Take the Input from the User
radius = float(input("Enter the Radius of a Sphere: "))

# Calculate the Surface Area
sa =  4 * PI * radius * radius

# Calculate the Volume
Volume = (4 / 3) * PI * radius * radius * radius

# Print the Output
print("\nThe Surface area of a Sphere = %.2f" %sa)
print("\nThe Volume of a Sphere = %.2f" %Volume)
Output

Enter the Radius of a Sphere: 5

 

The Surface area of a Sphere = 314.00

 

The Volume of a Sphere = 523.33


Related Posts



Comments

Recent Posts
Tags