Advertisement
scipiguy

Python 101: Hot-tub water volume

Apr 22nd, 2019
123
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.79 KB | None | 0 0
  1. # Futurelearn: Python 101 from RPi Foundation - Hot Tub Volume
  2. from math import pi
  3.  
  4. print("Hi, I am your personal 'bot' called Sam.  \nI will work out how much water you need in a circular hot-tub!\n")
  5.  
  6. users_name = input("Please enter your name: ")
  7. print("Welcome " + users_name + "!")
  8.  
  9. print("\nFirst, let's get some numbers...")
  10. diameter = input("How wide, in metres, is the inside of your circular hot-tub? ")
  11. height = input("How high up, in metres, should the water be in your hot-tub? ")
  12.  
  13. radius = round(float(diameter)/2,2)
  14. height_cast = float(height)
  15.  
  16. volume = round(pi * radius * radius * height_cast,2)
  17. output = str(volume)
  18. 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