keyboard_arrow_left keyboard_arrow_right
Ekjot's Project

Surface Area and Volume calculator

About Ekjot

I am Ekjot Kaur, a 10th grader who is really passionate to learn. I'm extremely curious about astrophysics and astronomy. I also love doing coding and photography. I think computers and technical devices really fascinate me because of their enormous potential. I look forward to becoming an astrophysicist and a coder.

Ekjot's project details:

Checkout my Surface Area and Volume calculator. You can calculate the Surface Area and Calculator for some of the most used geometric shapes. Make sure you enter all values in the same units.

I have created a calculator using concepts of Python programming language.


print("Welcome to Surface Area and Volume calculator.")
print("MAKE SURE TO ENTER THE VALUES WITH SAME UNIT")
        
sav = input("""What do you want to calculate?
            Please answer as "Surface Area" or "Volume":-  """)
sav1 = sav.lower()

#value of pi
pi = 22/7

if sav1 == "surface area":
    print("""You can calculate the surface area of the following shapes:
        -->Square
        -->Rectangle
        -->Triangle
        -->Circle
        -->Parallelogram
        -->Cube
        -->Cuboid 
        -->Cone
        -->Cylinder
        -->Sphere
        -->Hemisphere""")
    shape = input("Which shape?: ")
    shape1 = shape.lower()
    
    if shape1 == "square":
        side = float(input("Please enter the side length: "))
        ans = side**2
        print("Your answer is:", ans)
        
    elif shape1 == "rectangle":
        length = float(input("Please enter the figure length: "))
        breadth = float(input("Please enter the figure breadth: "))
        ans = length*breadth
        print("Your answer is:", ans)
        
    elif shape1 == "triangle":
        a = float(input("Please enter the length of side A: "))
        b = float(input("Please enter the length of side B: "))
        c = float(input("Please enter the length of side C: "))
        s = (a+b+c)/2
        ans = (s*(s-a)*(s-b)*(s-c))**0.5
        print("Your answer is:", ans)
        
    elif shape1 == "circle":
        radius = float(input("Please enter the figure radius: "))
        ans = pi*(radius**2)
        print("Your answer is:", ans)

    elif shape1 == "parallelogram":
        base = float(input("Please enter the base value: "))
        height = float(input("Please enter the figure height: "))
        ans = base*height
        print("Your answer is:", ans)
        
    elif shape1 == "cube":
        side = float(input("Please enter the side length: "))
        ans = 6*(side**2)
        print("Your answer is:", ans)
        
    elif shape1 == "cuboid":
        length = float(input("Please enter the figure length: "))
        breadth = float(input("Please enter the figure breadth: "))
        height = float(input("Please enter the figure height: "))
        ans = 2*((length*breadth)*(length*height)*(breadth*height))
        print("Your answer is:", ans)
    
    elif shape1 == "cone":
        radius = float(input("Please enter the base radius: "))
        slant_height = float(input("Please enter the slant height: ")) 
        ans = pi*radius*slant_height
        print("Your answer is:", ans)
        
    elif shape1 == "cylinder":
        radius = float(input("Please enter the base radius: "))
        height = float(input("Please enter the figure height: ")) 
        ans = 2*pi*radius*height
        print("Your answer is:", ans)
        
    elif shape1 == "sphere":
        radius = float(input("Please enter the base radius: "))
        ans = 4*pi*(radius**2)
        print("Your answer is:", ans)
        
    elif shape1 == "hemisphere":
        radius = float(input("Please enter the base radius: "))
        ans = 3*pi*(radius**2)
        print("Your answer is:", ans)
        
    else:
        print("Invalid Input.")
        
elif sav1 == "volume":
    print("""You can calculate the volumes of following shapes:
            -->Cube
            -->Cuboid 
            -->Cone
            -->Cylinder
            -->Sphere
            -->Hemisphere""")
    shape = input("Which shape?: ")
    shape1 = shape.lower()
    
    if shape1 == "cube":
        side = float(input("Please enter the side length: "))
        ans = side**3
        print("Your answer is:", ans)
        
    elif shape1 == "cuboid":
        length = float(input("Please enter the figure length: "))
        breadth = float(input("Please enter the figure breadth: "))
        height = float(input("Please enter the figure height: "))
        ans = length*breadth*height
        print("Your answer is:", ans)
        
    elif shape1 == "cone":
        radius = float(input("Please enter the base radius: "))
        height = float(input("Please enter the figure height: ")) 
        ans = (1/3)*pi*(radius**2)*height
        print("Your answer is:", ans)
        
    elif shape1 == "cylinder":
        radius = float(input("Please enter the base radius: "))
        height = float(input("Please enter the figure height: ")) 
        ans = pi*(radius**2)*height
        print("Your answer is:", ans)
        
    elif shape1 == "sphere":
        radius = float(input("Please enter the base radius: "))
        ans = (4/3)*pi*(radius**3)
        print("Your answer is:", ans)
        
    elif shape1 == "hemisphere":
        radius = float(input("Please enter the base radius: "))
        ans = (2/3)*pi*(radius**3)
        print("Your answer is:", ans)
        
    else:
        print("Invalid Input.")
        
else:
        print("Invalid Input.")
                                           
Name: Ekjot Kaur
Grade: 10
Be the Next Creator like :