lesson
Index of the maximum
objective: debugging exercise · lists & indexing · medium
Task type: fix broken code
index_of_max(nums) should return the position of the largest number in the list — not the number itself.
fix this code so it matches
index_of_max([3, 7, 2]) is 1 (7 is at index 1). index_of_max([9, 1, 2]) is 0. index_of_max([5]) is 0.
- ○Passes the visible tests
- ○Passes the hidden tests (edge cases)
Go deeper
Lesson resources
index_of_max.pyattempt 0
1
2
3
4
5
6
7