Fix: Ensure all skills are tracked as files, not submodules
This commit is contained in:
@@ -0,0 +1,21 @@
|
||||
from typing import List
|
||||
|
||||
|
||||
def sort_numbers(numbers: str) -> str:
|
||||
""" Input is a space-delimited string of numberals from 'zero' to 'nine'.
|
||||
Valid choices are 'zero', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight' and 'nine'.
|
||||
Return the string with numbers sorted from smallest to largest
|
||||
>>> sort_numbers('three one five')
|
||||
'one three five'
|
||||
"""
|
||||
word_to_num = {
|
||||
'zero': 0, 'one': 1, 'two': 2, 'three': 3, 'four': 4,
|
||||
'five': 5, 'six': 6, 'seven': 7, 'eight': 8, 'nine': 9
|
||||
}
|
||||
|
||||
if not numbers.strip():
|
||||
return ''
|
||||
|
||||
words = numbers.split()
|
||||
sorted_words = sorted(words, key=lambda x: word_to_num[x])
|
||||
return ' '.join(sorted_words)
|
||||
Reference in New Issue
Block a user