Resistance Label

Three resistor color bands can be turned into a readable resistance label. The function label receives a list colors: the first two colors give the significant digits, and the third color gives the multiplier as a power of 10. Return a string using ohms, or kiloohms when the value is best written in kiloohms.

Примеры

Ввод
["orange", "orange", "black"]
Вывод
"33 ohms"
Ввод
["blue", "grey", "brown"]
Вывод
"680 ohms"
Ввод
["red", "black", "red"]
Вывод
"2 kiloohms"

Нужно реализовать

def label(colors: list[str]) -> str:

Теги

listsstrings
PostgreSQLv16
Entre para enviar

O resultado da execução do código aparecerá aqui

Visible tests
1
Input
["orange","orange","black"]
Expected"33 ohms"
2
Input
["blue","grey","brown"]
Expected"680 ohms"
3
Input
["red","black","red"]
Expected"2 kiloohms"
4
Input
["green","brown","orange"]
Expected"51 kiloohms"
5
Input
["black","black","black"]
Expected"0 ohms"
6
Input
["black","red","red"]
Expected"200 ohms"
Focus radio
Paused · SomaFM · Fluid