Welcome to the Python screen.
The question is on your right: Compute Series Parallel Resistance. Read through the requirements first.
Run and submit your code as often as you need. You also have five interviewer messages this session - want to talk through your approach, or are you ready to start coding?
Given an array of resistor values in ohms and an array of operations describing how they are connected, compute the equivalent resistance of the circuit. Each operation is one of:
"R i" — push resistor values[i] onto the stack"S" — pop the top two resistances and replace them with their series equivalent"P" — pop the top two resistances and replace them with their parallel equivalent using 1 / (1/a + 1/b)Return the final equivalent resistance as a floating-point number. If the operations are invalid, return -1.0.
"R i" must satisfy 0 <= i < values.lengthdef equivalent_resistance(values, ops):