python_errors_summary
python_errors_summary
1. Syntax Errors
- for i in range(5) print(i) -> Missing colon (:) after for loop
- def func() print("hi") -> Missing colon (:) after function definition
- def 123func(): pass -> Function name cannot start with a number
2. Runtime Errors
3. Semantic Errors
- def add(a, b): return a - b -> Wrong operation: subtraction instead of addition
- def is_even(n): return n % 2 == 1 -> Wrong condition for checking even number
- def multiply(a, b): return a + b -> Wrong operation: addition instead of multiplication
- max = 0; for x in lst: if x > max: max = x -> Wrong initial value for all-negative list