Resistor in Series and Parallel

In this blog post we will create a Python program that will help us calculate the total resistance when two resistors are connected either in series or in parallel.

This program will be based on the following formulae:

Program Flowchart


Create the Code

Your task consists of implementing the code described in the above flowchart using Python. Then you will have to test your code by completing the test plan below.

Test Plan

Once your code is done, complete the following tests to check that your code is working as it should:

Test # Input Values Expected Output Actual Output
#1 R1: 6 (Ohms)
R2: 6 (Ohms)
12 Ohms
#2 R1: 6 (Ohms)
R2: 6 (Ohms)
3 Ohms
#3 R1: 6 (Ohms)
R2: 12 (Ohms)
18 Ohms
#4 R1: 6 (Ohms)
R2: 12 (Ohms)
4 Ohms
#5 R1: 33000 (Ohms)
R2: 56000 (Ohms)
89000 Ohms
#6 R1: 33000 (Ohms)
R2: 56000 (Ohms)
20764 Ohms


The solution for this challenge is available to full members!
Find out how to become a member:
➤ Members' Area

Did you like this challenge?

Click on a star to rate it!

Average rating 5 / 5. Vote count: 3

No votes so far! Be the first to rate this post.

As you found this challenge interesting...

Follow us on social media!

Tagged with: ,