Pipes in pool / Тръби в басейн
Здравейте. И аз се включвам по темата и не мога да разбера защо моята програма не работи коректно. Прилагам сорз кода:
volume = int(input()) p1 = int(input()) p2 = int(input()) hours = float(input()) p1_water_fill = p1 * hours p2_water_fill = p2 * hours water = p1_water_fill + p2_water_fill if water <= volume: volume_percent = water / (volume / 100) p1_percent = p1_water_fill / water * 100 p2_percent = p2_water_fill / water * 100 print(f"The pool is {volume_percent:.2f}% full. Pipe 1: {(p1_percent):.2f}%. Pipe2: " f"{(p2_percent):.2f}%") else: overflow = water - volume print(f"For {hours:.1f} hours the pool overflows with {overflow:.0f} liters.")