+ 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.
11 Respuestas
+ 4
There is nothing wrong with your code. It prints 5.0
+ 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.
+ 2
https://sololearn.com/compiler-playground/c4b3cNsO8Amt/?ref=app
link your complete code
+ 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
+ 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
+ 2
Nothing wrong
+ 1
Numan Batur ,
Please add (solved) to the title of your post.
+ 1
Numan Batur ,
Code is correct and the answer is 5.0
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
0
Code is correct 💯
0
If u wanna solve and teach something you can check my other questions guys 😅 Thank you all