Last modified: Apr 28, 2026 By Alexander Williams
Fix: TypeError Float Object Is Not Callable
Have you ever seen this error in Python? It is common for beginners. The error says "TypeError: 'float' object is not callable". It can be confusing. But the fix is simple once you understand the cause.
This article explains why this error happens. You will see clear examples. You will learn how to fix it. By the end, you will avoid this mistake in your own code.
What Does This Error Mean?
Python uses parentheses () to call functions. When you write my_function(), Python tries to execute the function. But if my_function is a float number, Python cannot call it. A float is not a function. So Python raises a TypeError.
The error message tells you exactly what is wrong. It says 'float' object is not callable. This means you are trying to use a floating-point number as a function.
Common Causes
There are two main reasons for this error. The first is overwriting a built-in function. The second is using parentheses on a float variable.
1. Overwriting a Built-In Function
Python has built-in functions like float(), int(), and str(). If you create a variable with the same name, you replace the function. Later, when you try to use the function, Python finds the variable instead.
Look at this example:
# Bad: overwriting the float() function
float = 3.14
print(float) # Works fine, prints 3.14
# Now try to convert a string to a float
value = float("42") # Error! float is now a number, not a function
Output:
3.14
TypeError: 'float' object is not callable
The variable float stores the number 3.14. When you write float("42"), Python tries to call the number 3.14. It cannot. That is the error.
2. Using Parentheses on a Float Variable
Another common mistake is adding parentheses to a float variable by accident. This happens often when you copy code or type quickly.
# Mistake: adding parentheses to a float variable
price = 19.99
print(price()) # Error! price is a float, not a function
Output:
TypeError: 'float' object is not callable
The parentheses after price make Python think you want to call it. But price is a float. It cannot be called.
How to Fix the Error
The fix depends on the cause. Here are the solutions for each case.
Fix 1: Do Not Overwrite Built-In Functions
Never use names like float, int, str, list, or dict for your variables. Use descriptive names instead.
# Good: use a different variable name
pi_value = 3.14
print(pi_value) # Works fine
# Now float() still works correctly
value = float("42") # Works! Returns 42.0
print(value) # Output: 42.0
Output:
3.14
42.0
If you already overwrote a built-in function, you can fix it by restarting your Python session or deleting the variable with del float.
Fix 2: Remove Unnecessary Parentheses
If you added parentheses to a float variable by mistake, simply remove them.
# Fix: remove parentheses
price = 19.99
print(price) # Works fine, prints 19.99
Output:
19.99
Always check your code for extra parentheses. They are easy to miss.
Real-World Example
Imagine you are building a program to calculate the area of a circle. You use the constant pi and the built-in float() function. If you accidentally name a variable float, the program breaks.
# Real-world mistake
radius = 5
float = 3.14159 # Overwrites the float() function
area = float(radius ** 2) # Error!
print(area)
Output:
TypeError: 'float' object is not callable
The fix is simple. Rename the variable to something else, like pi or pi_value.
# Fixed version
radius = 5
pi_value = 3.14159
area = float(radius ** 2) # float() works again
print(area) # Output: 78.53975
Output:
78.53975
How to Prevent This Error
Here are three simple rules to avoid this error.
- Use descriptive variable names. Do not use names of built-in functions like
float,int,str, orlist. - Check your parentheses. Make sure you only use parentheses to call functions, not on variables that store numbers.
- Use a linter. Tools like
pylintorflake8can warn you if you overwrite a built-in function.
Following these rules will save you time and frustration.
Related Python Topics
Understanding data types is essential in Python. If you are new to the language, check out our guide on Python Character Encoding Guide for Beginners to handle text data properly. You might also find it useful to read about other common Python errors like TypeError: 'int' object is not callable and TypeError: 'str' object is not callable. They have similar causes and solutions.
Conclusion
The TypeError: 'float' object is not callable happens when you try to call a float number as if it were a function. The two main causes are overwriting the built-in float() function and adding parentheses to a float variable. The fixes are straightforward: use different variable names and remove extra parentheses.
Now you know how to identify and fix this error. Practice writing clean code. Avoid overwriting built-in functions. Check your parentheses carefully. With these habits, you will see this error much less often. Happy coding!