Create a variable equal to 99.
In : x2 = 99
Check its type.
In : type(99)
Check the type of the value 0.99.
In : type(0.99)
Turn 99 into a float.
In : float(99)
TypeError Traceback (most recent call last) <ipython-input-18-0e339d82228c> in <module> ----> 1 float(99) TypeError: 'int' object is not callable
– I am trying to convert 99 into float but it showing error. I am trying another way which is float(x2), but still it showing error.
Kindly help me out of this.
Thanks for reaching out!
Your code is per se correct. Therefore, what may be causing the issue is if at some point, previously in your notebook document, you have created a variable float containing an integer value. For example, you may have executed the following:
float = 99
If you’ve really done this, this means when executing float(99), Python is trying to call float and it doesn’t know what to do with the parentheses and the number between them afterwards.
To solve this problem, please restart your kernel (which you can do by selecting Kernel/Restart & Clear Output => Restart and Clear All Outputs), and retry running your code without assigning an integer (or any other value) to a variable called float.
Hope this helps.
Yeah, you are right after restating the kernel now it’s convert.Thank You Martin.
Great! You are welcome!