Question 10
Back to Exercise
What happens with a[len(a) / 2]?
- A It returns the middle item
- B TypeError: list indices must be integers, and / returns a float; use // Correct
- C It rounds the index
- D IndexError
Correct Answer: Option B
Even when the division is exact, len(a) / 2 is a float such as 2.0.
Discussion & Comments 0
Share your method, a shortcut, or ask about a step you didn't follow.
No comments yet. Be the first to share your solution!