Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Futurelearn: Python 101 from RPi Foundation - Hot Tub Volume
- from math import pi
- print("Hi, I am your personal 'bot' called Sam. \nI will work out how much water you need in a circular hot-tub!\n")
- users_name = input("Please enter your name: ")
- print("Welcome " + users_name + "!")
- print("\nFirst, let's get some numbers...")
- diameter = input("How wide, in metres, is the inside of your circular hot-tub? ")
- height = input("How high up, in metres, should the water be in your hot-tub? ")
- radius = round(float(diameter)/2,2)
- height_cast = float(height)
- volume = round(pi * radius * radius * height_cast,2)
- output = str(volume)
- print("\nFor a hot-tub with a diameter " + diameter + " metres and water height " + height + " metres, the volume of water is " + output + " cubic metres.")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement