Color Band Value
On resistors, colored bands encode digits, so each color can be converted into a number. The function color_code receives a color name color as a string and returns its value in order: black is 0, brown is 1, and so on up to white as 9.
Примеры
Ввод
"black"Вывод
0Ввод
"white"Вывод
9Ввод
"orange"Вывод
3Нужно реализовать
def color_code(color: str) -> int:
Теги
listsstrings
Conectează-te pentru a vedea istoricul soluțiilor trimise
Conectează-teConectează-te pentru a folosi Mentorul AI
Conectează-teVisible tests
1
Input
"black"Expected
02
Input
"white"Expected
93
Input
"orange"Expected
34
Input
"green"Expected
55
Input
"violet"Expected
7Focus radio
Paused · SomaFM · Fluid