You are viewing a single comment's thread. Return to all comments →
def sorting_strings(some_string: str) -> str:
some_string = list(some_string) some_string.sort(key=lambda x: (x.isdigit(), x.isupper(), x)) only_numbers = list(filter(lambda x: x.isdigit(), some_string)) only_letters = list(filter(lambda x: x.isalpha(), some_string)) odds = list(filter(lambda x: int(x) % 2 == 1, only_numbers)) evens = list(filter(lambda x: int(x) % 2 == 0, only_numbers))
return ''.join(only_letters+odds+evens)
if name == 'main': S = input() print(sorting_strings(S))
Seems like cookies are disabled on this browser, please enable them to open this website
ginortS
You are viewing a single comment's thread. Return to all comments →
def sorting_strings(some_string: str) -> str:
return ''.join(only_letters+odds+evens)
if name == 'main': S = input() print(sorting_strings(S))