Sort and take the first

Take your time, follow the code and check your understanding.

Move blocks into orderLists
  1. print(smallest)
  2. smallest = ordered[0]
  3. ordered = sorted(scores)
  4. scores = [8, 3, 5]
Your answer3 min · no timer

Drag blocks, or use the arrow buttons. Keep the displayed indentation. This task uses the taught sequence; other equivalent programs may also be valid.

Show solution and explanation

sorted returns a new list. Its first item is the smallest number.

scores = [8, 3, 5]
ordered = sorted(scores)
smallest = ordered[0]
print(smallest)