add more comments

This commit is contained in:
Spy 2022-09-20 10:40:37 +01:00
parent 4a4033c393
commit cdbf30eeb3

View File

@ -55,16 +55,19 @@ def calc_resistor(colours, bands):
tolerance = 0 tolerance = 0
for i, colour in enumerate(colours): for i, colour in enumerate(colours):
# Get the band # Get the band value from
if i < 3: if i < 3:
bands_value += str(bands[colour]["band"]) bands_value += str(bands[colour]["band"])
# Get the multiplier
elif i == 3: elif i == 3:
multiplier = bands[colour]["multiplier"] multiplier = bands[colour]["multiplier"]
# Get the tolerance
elif i == 4: elif i == 4:
tolerance = bands[colour]["tolerance"] tolerance = bands[colour]["tolerance"]
# Calculate the resistor value
resistor_value = int(bands_value) * multiplier resistor_value = int(bands_value) * multiplier
return resistor_value, tolerance return resistor_value, tolerance