Skip to content

Commit

Permalink
Update order.py
Browse files Browse the repository at this point in the history
  • Loading branch information
ikostan committed Dec 18, 2024
1 parent 70891e1 commit 6dd86f2
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions kyu_6/your_order_please/order.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,11 @@

def order(sentence: str) -> str:
"""
Sort a given string by following rules:
Sort a given string by rules listed below.
1. Each word in the string will contain a single number.
This number is the position the word should have in the result.
2. Note: Numbers can be from 1 to 9. So 1 will be the first word (not 0).
3. If the input string is empty, return an empty string. The words in the
input String will only contain valid consecutive numbers.
Expand All @@ -28,4 +26,5 @@ def order(sentence: str) -> str:
if str(i) in word:
results.append(word)
break

return ' '.join(results)

0 comments on commit 6dd86f2

Please sign in to comment.