Hi! I'm just starting to learn python and am wondering why this code isn't working. Can someone help me out?

I'm trying to build a calculator that will compute surface area and volume of various objects. This is what I've written so far:

q = input ("What would you like to calculate? (cylinder/pyramid) ")

if q == cylinder : 
r = int(input("What is the radius of the circle atop the cylinder? "))
h = int(input("What is the height of the cylinder? "))
area = (pi*(r**2))
circu = (2*pi*r)
SA = ((circu*h)+(area*2))
Volume = (area*h)
print(f"The surface area of the cylinder is {SA}")
print(f"The volume of the cylinder is {Volume}")
else {
l = int(input ("What is the lenghth of the pyramid? "))
h = int(input  ("What is the height of the pyramid? "))
w = int(input  ("What is the width of the pyramid? "))
answer1 = (l*w*h)/3
answer2 = (l*w)+(l*h*2)+(w*h*2)
print(f"The volume of the pyramid is {answer1}") 
print(f"The surface area of the pyramid is {answer2}")
} ```




    



from Recent Questions - Stack Overflow https://ift.tt/2Y5f33d
https://ift.tt/eA8V8J

Comments

Popular posts from this blog

Today Walkin 14th-Sept

Spring Elasticsearch Operations

Hibernate Search - Elasticsearch with JSON manipulation