Read Hex Numbers
Hexadecimal numbers often appear in colors, memory addresses, and low-level data. The function hexa receives a string hex_string and converts it to a decimal number, ignoring letter case. If the string contains a character that is not valid in hexadecimal notation, raise ValueError.
Примеры
Ввод
"1"Вывод
1Ввод
"10"Вывод
16Ввод
"2f"Вывод
47Нужно реализовать
def hexa(hex_string: str) -> int:
Теги
mathstrings
Entre para ver seu histórico de envios
EntrarEntre para usar o AI Mentor
EntrarVisible tests
1
Input
"1"Expected
12
Input
"10"Expected
163
Input
"2f"Expected
474
Input
"ff"Expected
2555
Input
"a1"Expected
1616
Input
"cafe"Expected
51966Focus radio
Paused · SomaFM · Fluid