Update README.md
This commit is contained in:
parent
29858e152d
commit
fc8dd7d9bf
1 changed files with 29 additions and 0 deletions
29
README.md
29
README.md
|
|
@ -1,5 +1,34 @@
|
||||||
# Sort Array By Letter
|
# Sort Array By Letter
|
||||||
|
|
||||||
|
## Question
|
||||||
|
|
||||||
|
[Sloth Bytes | 2024-07-30](https://slothbytes.beehiiv.com/p/oop-pillar-1-abstraction-dummies?utm_source=slothbytes.beehiiv.com&utm_medium=newsletter&utm_campaign=oop-pillar-1-abstraction-for-dummies)
|
||||||
|
|
||||||
|
```
|
||||||
|
Sort by the Letters
|
||||||
|
Write a function that sorts each string in a list by the letter in alphabetic ascending order (a-z).
|
||||||
|
|
||||||
|
Examples
|
||||||
|
sort_by_letter(["932c", "832u32", "2344b"])
|
||||||
|
output = ["2344b", "932c", "832u32"]
|
||||||
|
|
||||||
|
sort_by_letter(["99a", "78b", "c2345", "11d"])
|
||||||
|
output = ["99a", "78b", "c2345", "11d"]
|
||||||
|
|
||||||
|
sort_by_letter(["572z", "5y5", "304q2"])
|
||||||
|
output = ["304q2", "5y5", "572z"]
|
||||||
|
|
||||||
|
sort_by_letter([])
|
||||||
|
output = []
|
||||||
|
|
||||||
|
#here's your starting point :)
|
||||||
|
def sort_by_letter(arr):
|
||||||
|
|
||||||
|
Notes
|
||||||
|
- Each string will only have one (lowercase) letter.
|
||||||
|
- If given an empty list, return an empty list.
|
||||||
|
```
|
||||||
|
|
||||||
## Description
|
## Description
|
||||||
|
|
||||||
This utility takes a user input of array string number and sort it by the letter of each element. The utility will then display the sorted array.
|
This utility takes a user input of array string number and sort it by the letter of each element. The utility will then display the sorted array.
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue