medium
Python List Comprehension Fix
Identify and fix a logic error in a Python list comprehension snippet.
📝 Conteúdo do Prompt
Analyze the following Python list comprehension and explain why it throws an IndexError: 'result = [x for x in range(10) if my_list[x] > 5]'. Provide the corrected code that avoids the error assuming my_list has fewer than 10 elements.