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
PostgreSQLv16

Qui apparirà il risultato dell'esecuzione del codice

Visible tests
1
Input
"black"
Expected0
2
Input
"white"
Expected9
3
Input
"orange"
Expected3
4
Input
"green"
Expected5
5
Input
"violet"
Expected7
Focus radio
Paused · SomaFM · Fluid