File tree Expand file tree Collapse file tree 1 file changed +38
-1
lines changed
exercises/practice/resistor-color-duo Expand file tree Collapse file tree 1 file changed +38
-1
lines changed Original file line number Diff line number Diff line change 1+
2+ dict = {
3+ "black" : 0 ,
4+ "brown" : 1 ,
5+ "red" : 2 ,
6+ "orange" : 3 ,
7+ "yellow" : 4 ,
8+ "green" : 5 ,
9+ "blue" : 6 ,
10+ "violet" : 7 ,
11+ "grey" : 8 ,
12+ "white" : 9
13+ }
14+
15+
16+ def get_color1_index (color1 ):
17+ if color1 in dict :
18+ for c in dict :
19+ s = dict [color1 ]
20+ return s
21+ else :
22+ return "The color doesn't exist."
23+
24+ def get_color2_index (color2 ):
25+ if color2 in dict :
26+ for c in dict :
27+ s = dict [color2 ]
28+ return s
29+ else :
30+ return "The color doesn't exist."
31+
132def value (colors ):
2- pass
33+ color1 = colors [0 ]
34+ color2 = colors [1 ]
35+ ind1 = str (get_color1_index (color1 ))
36+ ind2 = str (get_color2_index (color2 ))
37+ ind = ind1 + ind2
38+ value = int (ind )
39+ return value
You can’t perform that action at this time.
0 commit comments