Which fix removes the bug?
import math
def area(r):
return math.pi * r ^ 2
- Use ** instead of ^
- Import math at the top
- Wrap r in float()
- Round the result
^ is bitwise XOR in Python, and XOR on a float raises TypeError; exponentiation is **.import math
def area(r):
return math.pi * r ^ 2
^ is bitwise XOR in Python, and XOR on a float raises TypeError; exponentiation is **.