Sichanov

pipes book

Jul 3rd, 2021
149
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.48 KB | None | 0 0
  1. from math import trunc
  2.  
  3. v = int(input())
  4. p1 = int(input())
  5. p2 = int(input())
  6. h = float(input())
  7.  
  8. litres = (p1 + p2) * h
  9.  
  10. if litres > v:
  11.     overfilled = litres - v
  12.     print(f'For {h} hours the pool overflows with {overfilled} liters.')
  13. else:
  14.     filled = trunc((litres / v) * 100)
  15.  
  16.     percentp1 = trunc((p1 * h) / litres * 100)
  17.     percentp2 = trunc((p2 * h) / litres * 100)
  18.     print(f'The pool is {filled:.2f}% full. Pipe 1: {percentp1:.2f}%. Pipe 2: {percentp2:.2f}%.')
Advertisement
Add Comment
Please, Sign In to add comment