Character Mix
Sometimes you need a quick breakdown of what a string contains: letters, digits, and everything else. The function count_char_types receives a string s and returns a list of three numbers. The first number is the count of letters, the second is the count of digits, and the third is the count of all other characters.
Примеры
Ввод
"abc123!!"Вывод
[3, 3, 2]Ввод
""Вывод
[0, 0, 0]Ввод
"hello"Вывод
[5, 0, 0]Нужно реализовать
def count_char_types(s: str) -> list[int]:
Теги
stringsdict
Sign in to see submission history
Sign inSign in to use AI Mentor
Sign inVisible tests
1
Input
"abc123!!"Expected
[3,3,2]2
Input
""Expected
[0,0,0]3
Input
"hello"Expected
[5,0,0]4
Input
"12 34"Expected
[0,4,1]5
Input
"a1 "Expected
[1,1,1]6
Input
"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"Expected
[30,0,0]Focus radio
Paused · SomaFM · Fluid