Ddimov90

pipes_in_pool_01_03

Sep 22nd, 2025
41
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.69 KB | Source Code | 0 0
  1. pool_volume = int(input())
  2. first_pipe = int(input())
  3. second_pipe = int(input())
  4. hours = float(input())
  5.  
  6. first_pipe_volume = first_pipe * hours
  7. second_pipe_volume = second_pipe * hours
  8. total_volume = first_pipe_volume + second_pipe_volume
  9. total_volume_percent = total_volume / pool_volume * 100
  10. first_pipe_percent = first_pipe_volume / total_volume * 100
  11. second_pipe_percent = second_pipe_volume / total_volume * 100
  12.  
  13. if total_volume <= pool_volume:
  14.     print(f"The pool is {total_volume_percent:.2f}% full. Pipe 1: {first_pipe_percent:.2f}%. Pipe 2: {second_pipe_percent:.2f}%.")
  15. else:
  16.     print(f"For {hours} hours the pool overflows with {total_volume - pool_volume:.2f} liters.")
  17.    
Advertisement
Add Comment
Please, Sign In to add comment