write a program that prompts the user for the radius and height of a 3-dimensional cone and then calculates and prints the surface area and volume of the cone. The calculation of the surface area and the volume will be done in functions, as will the gathering of the inputs.
Your program for this part will function as follows:
- Print out a message indicating what the program does.
- Prompt the user for the radius (a non-negative float) in feet.
- Prompt the user for the height (a non-negative float) in feet.
- Print the radius and height, but rounded to 2 decimal digits.
- Print the surface area and volume, rounded to 2 decimal digits.
Here is what I done so far:
import math
print("This Program will calculate the surface area and volume of a cone."
"\nPlease follow the directions.")
print()
print()
r = input(str("What is the radius in feet? (no negatives): "))
h = input(str("What is the height in feet? (no negatives): "))
math.pi = (22.0/7.0)
math.sqrt()
surfacearea = int(math.pi*r**2)+int(r*math.pi(math.sqrt(r**2+h**2)))
print("The surface area is", surfacearea)
print()
volume = (1/3)*math.pi*r**2*h
print ("The volume is", volume)
print()
print("Your Answer is:")
print()
print("A cone with radius", r, "\nand hieght", h,"\nhas a volume of : ",volume,
"\nand surface area of", surfacearea,)
I keep getting errors
TypeError: unsupported operand type(s) for ** or pow(): 'str' and 'int'
TypeError: can't multiply sequence by non-int of type 'float'
Can anyone help me get pass this little wall block I think 'float' is part of the problem. I think the setup is good but the execuption is the problem.