This forum uses cookies
This forum makes use of cookies to store your login information if you are registered, and your last visit if you are not. Cookies are small text documents stored on your computer; the cookies set by this forum can only be used on this website and pose no security risk. Cookies on this forum also track the specific topics you have read and when you last read them. Please confirm whether you accept or reject these cookies being set.

A cookie will be stored in your browser regardless of choice to prevent you being asked this question again. You will be able to change your cookie settings at any time using the link in the footer.

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Python Petrol Capacity
#1
Rectangle
Code:
# Python Petrol Capacity
#4/7/2018
#name

print("******************************")
print(" Python Petrol Capacity")
print("******************************")
print("\n\n")

height = float(input("Enter the container height (cm): "))
width = float(input("Enter the container width (cm): "))
depth = float(input("Enter the container depth (cm): "))

capacity = round((height * width * depth) / 1000 ),2)
print("The container holds " + capacity + " litres of petrol")
Cylinder

Code:
# Python Petrol Capacity
#4/7/2018
#name

print("******************************")
print(" Python Petrol Capacity")
print("******************************")
print("\n\n")


radius = float(input("Enter the cylinder radius: "))
height = float(input("Enter the cylinder height: "))
pie = 3.14159 
volume = round(pie * (radius*radius) * height ,2)
print("The container holds ",volume )
Disclaimer: Don't be misguided looking at my usergroup and assume whatever I say is official. When I speak in community I am just a member with personal opinions.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)
www.000webhost.com