Digit Split
Sometimes data needs to be quickly turned into a simple two-symbol code, such as separating small values from large ones. Write a function fake_bin that takes a string x made of digits. Replace every digit less than 5 with 0, and every digit 5 or greater with 1.
Примеры
Ввод
"45385593107843568"Вывод
"01011110001100111"Ввод
"509321967506747"Вывод
"101000111101101"Ввод
"1"Вывод
"0"Нужно реализовать
def fake_bin(x: str) -> str:
Теги
strings
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inVisible tests
1
Input
"45385593107843568"Expected
"01011110001100111"2
Input
"509321967506747"Expected
"101000111101101"3
Input
"1"Expected
"0"4
Input
"5"Expected
"1"5
Input
"00000"Expected
"00000"6
Input
""Expected
""Focus radio
Paused · SomaFM · Fluid