(Solved!) float error | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 9

(Solved!) float error

int1=5 x=float(int1) print(x) TypeError: 'float' object is not callable As i know it must be print as ‚Äú5.0‚ÄĚ but it‚Äôs not. What can i do? There is no problem with ‚Äúint()‚ÄĚ or ‚Äústr()‚ÄĚ codes.

27th Dec 2023, 7:59 AM
Numan Batur
Numan Batur - avatar
11 Réponses
+ 4
There is nothing wrong with your code. It prints 5.0
27th Dec 2023, 8:31 AM
Jan
Jan - avatar
+ 3
Please read the previous replies before posting "the code is correct." It is not necessary to keep repeating the same thing. It just bloats the thread.
28th Dec 2023, 10:48 AM
Lisa
Lisa - avatar
27th Dec 2023, 8:35 AM
Lisa
Lisa - avatar
+ 2
Thank you all. When i create a new project and write codes, working. I guess something causing error in my old project. Solved! I recognise there is a variable named ‚Äúfloat‚ÄĚ and it cause error. :) <3
27th Dec 2023, 8:42 AM
Numan Batur
Numan Batur - avatar
+ 2
There are some good lessons in this. - never use built-in names or keywords to name your variables - linking your code is always helpful to avoid misunderstanding - sometimes the bug is in the part of the code which you do not consider - read the error message carefully, because it does mention the specific line of code which caused the error
27th Dec 2023, 9:12 AM
Tibor Santa
Tibor Santa - avatar
+ 2
Nothing wrong
27th Dec 2023, 12:19 PM
Clive Jesus John
Clive Jesus John - avatar
+ 1
Numan Batur , Please add (solved) to the title of your post.
27th Dec 2023, 10:05 AM
Rain
Rain - avatar
+ 1
Numan Batur , Code is correct and the answer is 5.0
27th Dec 2023, 8:38 PM
Shantanu Kanojia
Shantanu Kanojia - avatar
0
Thanks for your commet but it’s still same. Traceback (most recent call last): File "./Playground/file0.py", line 47, in <module> x=float(int1) TypeError: 'float' object is not callable
27th Dec 2023, 8:34 AM
Numan Batur
Numan Batur - avatar
0
Code is correct ūüíĮ
28th Dec 2023, 10:39 AM
Josephine Njemanze
Josephine Njemanze - avatar
0
If u wanna solve and teach something you can check my other questions guys ūüėÖ Thank you all
28th Dec 2023, 10:50 AM
Numan Batur
Numan Batur - avatar