i=10 i() -- it gives an error int is not callable why? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

i=10 i() -- it gives an error int is not callable why?

why int or str is not callable?

17th Apr 2019, 3:22 AM
Yogesh Mhaskule
4 Answers
+ 8
You can call a function. You just can't call a data type...
17th Apr 2019, 4:06 AM
Arushi Singhania
Arushi Singhania - avatar
+ 5
I think you can print I without a function but not in SoloLearn. And you can't call objects, you can call methods, functions and classes, but of an object, you only can get their attributes.
17th Apr 2019, 4:53 AM
InvBoy [ :: FEDE :: ]
InvBoy [ :: FEDE :: ] - avatar
0
It's an object anyway. Then it's Datatype? why python won't allow this? let's say I want print string using same way as my question I = "hello" I() I want output "hello" without creating any function.
17th Apr 2019, 4:18 AM
Yogesh Mhaskule
0
Your avatar is so cute
4th May 2019, 11:07 AM
bittersweet
bittersweet - avatar