Python Programming Part 2 Direction: Use PYTHON to solve this problem. Description: This part tests for two things. The program must identify all resistors in series or in parallel with each other and calculate the equivalent resistance for each group of resistors. Recall that total resistance of resistors in series are added up while the total conductance of those in parallel are added up. Input Format: The first line of the input consists of 1 integer N which is the total number of resistors. The next N lines will consist of 3 strings and an integer R each separated by a space. The first string is the resistor name, the second and third strings are the node names where the resistor terminals are connected, and R is its resistance value. Output Format: One line for each group of resistors in series or parallel. Each line starts with a list of resistors arranged in lexicographical order (see Lexicographic order - Wikipedia) followed by their total resistance rounded off to the nearest integer using the built-in int() Python function. The order that the groups are printed should also be in lexicographic order to ensure proper checking. Constraints: Your code needs to finish within 10s Be as precise as possible in the computation to avoid rounding errors in the final answer. 1 ≤ N ≤ 1000 and 0 < R ≤ (109) Sample Input and Output: (please see image)
Python Programming Part 2
Direction:
Use PYTHON to solve this problem.
Description:
This part tests for two things. The program must identify all resistors in series or in parallel with each other and calculate the equivalent resistance for each group of resistors. Recall that total resistance of resistors in series are added up while the total conductance of those in parallel are added up.
Input Format:
The first line of the input consists of 1 integer N which is the total number of resistors. The next N lines will consist of 3 strings and an integer R each separated by a space. The first string is the resistor name, the second and third strings are the node names where the resistor terminals are connected, and R is its resistance value.
Output Format:
One line for each group of resistors in series or parallel. Each line starts with a list of resistors arranged in lexicographical order (see Lexicographic order - Wikipedia) followed by their total resistance rounded off to the nearest integer using the built-in int() Python function. The order that the groups are printed should also be in lexicographic order to ensure proper checking.
Constraints:
- Your code needs to finish within 10s
- Be as precise as possible in the computation to avoid rounding errors in the final answer.
- 1 ≤ N ≤ 1000 and 0 < R ≤ (109)
Sample Input and Output: (please see image)
Step by step
Solved in 3 steps with 1 images