Question 24: If Elif Else

Write a Python program to determine if an electronic circuit is operating within safe limits based on voltage, current, and resistance.

  1. Ask the user for the circuit’s name and store it in a variable called circuit_name.
  2. Ask for the voltage of the circuit (in volts) and store it in a variable called voltage (as a float).
  3. Ask for the resistance of the circuit (in ohms) and store it in a variable called resistance (as a float).
  4. Calculate the current using Ohm’s Law:
    python
    current = voltage / resistance
  5. Use an if-elif-else structure to classify the circuit’s performance based on current:
    • If current is greater than 15 amps, print:
      "Warning, [circuit_name]! Your current is [current] amps, which exceeds safe operating limits!"
    • If current is between 10 and 15 amps (inclusive), print:
      "Caution, [circuit_name]! Your current is [current] amps. You're nearing the limit. Monitor closely!"
    • If current is less than 10 amps, print:
      "Safe, [circuit_name]! Your current is [current] amps. The circuit is operating within limits."
    • If resistance is 0, print:
      "Error: Resistance cannot be zero. Please check the input values for [circuit_name]."
Write what you are looking for, and press enter to begin your search!