Two Color Digits
On resistors, the first color bands encode the digits of the resistance value. The function value receives a list colors and uses the first two colors to build a two-digit number. The first color gives the tens digit, and the second color gives the ones digit.
Примеры
Ввод
["brown", "black"]Вывод
10Ввод
["blue", "grey"]Вывод
68Ввод
["yellow", "violet"]Вывод
47Нужно реализовать
def value(colors: list[str]) -> int:
Теги
listsstrings
Kirjaudu sisään nähdäksesi palautushistorian
Kirjaudu sisäänKirjaudu sisään käyttääksesi tekoälymentoria
Kirjaudu sisäänVisible tests
1
Input
["brown","black"]Expected
102
Input
["blue","grey"]Expected
683
Input
["yellow","violet"]Expected
474
Input
["white","white","white"]Expected
995
Input
["black","brown"]Expected
16
Input
["brown","black","brown"]Expected
10Focus radio
Paused · SomaFM · Fluid