When 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:
You can check the resistance value of a resistor online using an online calculator.
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:
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.