Medium
Fix Python Loop Logic Error
Identify and fix the logical error in a provided Python code snippet involving a for loop.
📝 Contenu du Prompt
The following Python code is intended to calculate the sum of even numbers from 1 to 10, but it currently returns incorrect results. Identify the logical error, explain why it happens, and provide the corrected code snippet. [Code: total = 0; for i in range(1, 11): if i % 2 == 1: total += i; print(total)]