Question 25: If Elif Else

Write a Python program to determine if a water pump system is operating within safe limits based on pressure, flow rate, and pipe diameter.

Instructions:

  1. Ask the user for the pump system’s name and store it in a variable called pump_name.

  2. Ask for the pressure of the system (in Pascals) and store it in a variable called pressure (as a float).

  3. Ask for the flow rate of the system (in cubic meters per second) and store it in a variable called flow_rate (as a float).

  4. Ask for the pipe diameter (in meters) and store it in a variable called diameter (as a float).

  5. Calculate the velocity of the water using the formula:

    velocity= (4 * flow_rate) / (π * diameter**2)

  6. Use an if-elif-else structure to classify the pump system’s performance based on velocity:

    • If velocity is greater than 3 m/s, print:
      "Warning, [pump_name]! Water velocity is [velocity] m/s, which exceeds safe limits!"
    • If velocity is between 2 and 3 m/s (inclusive), print:
      "Caution, [pump_name]! Water velocity is [velocity] m/s. Monitor the system closely!"
    • If velocity is less than 2 m/s, print:
      "Safe, [pump_name]! Water velocity is [velocity] m/s. The system is operating within limits."
    • If diameter is 0, print:
      "Error: Pipe diameter cannot be zero. Please check the input values for [pump_name]."
Write what you are looking for, and press enter to begin your search!