Question: need to use python to write a code for this qn Question 2: Resistors In electrical circuits, a resistor is used to reduce the flow
Question 2: Resistors In electrical circuits, a resistor is used to reduce the flow of current. Its capability to reduce the Row of current depends on its resistance value, measured on ohm (2). Figure 1: IEC resistor symbol (www.wikipedia.org). When connected in series, the total resistance is the sum of each individual resistance values. aww Ri R2 R. Figure 2: Resistor connected in series, the equivalent resistance value is Reg = R1 + R2+...+Rm. As an engineer, you are given a sequence of resistors which are already sorted in ascending order of resistance values but may contain duplicates. 2.1 Triplets [25 marks) While making your circuit, you require exactly three resistors that sums up to a given value R. Although each resistor can only be used once, luckily you have lots of resistors. Your task is to find a combination of three resistors that sums up to R but must also satisfies the following requirements: If there is no answer, return None. If there is at least one answer (R1, R2, R3), your answer must be in such a way that Ris R2 R3. If there are more than one answer, your answer should give the smallest possible R1 + R2. Question Write the function triplets(seq, R), which takes in a sequence of resistor seq as well as the value you need to find and returns a sequence of exactly three resistors that sums up to the required value R if there is such a solution. Otherwise returns None. You can assume that the input sequence contains only positive integers (int) sorted in ascending order
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
