Resistor Value Calculator

resistor-5When designing electronic circuits you may need to use resistors. Each resistor has a resistance value expressed in ohms (Ω). Resistors are identified by a series of concentric coloured bands. Each band colour has a value which is used to calculate the resistance value of the resistor.

Here is how the resistor colour code works:
Resistor-Color-Bands

Resistor-Color-Codes

You can check the resistance value of a resistor online using an online calculator.

Your Challenge


Your challenge consists of writing a program that asks the user to enter three colours (e.g. Red, Red, Green) and returns the resistance value (e.g. 2,200,000 Ω or 2,200 kΩ).

Test your code


Test your code to find the resistance value of the following three resistors:

Resistor1

Resistor2

Resistor3

Challenge #2: The other way round


Create a computer program that asks the user for a resistor value in ohms and returns the three colours matching this value.

Share Button
Posted in Computer Science, JavaScript, Python - Intermediate, Python Challenges Tagged with: ,

Our Latest Book