What is the correct fix?
items = ['b', 'a'] sorted(items) print(items[0])
- Assign it:
items = sorted(items)instead - Assign it:
items = items.sorted()instead - Change
sorted(items)toitems.sortonly - Print
items[-1]to read the first value
sorted() returns a new list and leaves the original untouched; the result was discarded.
Play Problem Solving ▸