Bug Description
power(2, -3) returns 1.0 instead of 0.125.
Steps to Reproduce
from calculator import power
result = power(2, -3)
print(result) # Expected: 0.125, Got: 1.0
Expected Behavior
power(2, -3) should return 0.125 (i.e., 2 ** -3).
Actual Behavior
Returns 1.0 because the for loop with range(-3) produces zero iterations.
Environment
- Python 3.x
- File: src/calculator.py
Bug Description
power(2, -3)returns1.0instead of0.125.Steps to Reproduce
Expected Behavior
power(2, -3)should return0.125(i.e.,2 ** -3).Actual Behavior
Returns
1.0because the for loop withrange(-3)produces zero iterations.Environment