+ 2
Why f=(0) is considered integer instead of tuple
While executing the code f=(0) print type(f) It returns integer as type
3 Respostas
+ 2
I guess because python thinks parentheses around 0 are for calculations or operators.
But there's one think I'm sure about: You should use "," if you want python to recognize it as a tuple:
f=(0,)
+ 2
if you do:
f = (0,1)
the result will be tuple. The same happens if you do:
f =() #or
f = (0,)
+ 1
Thanks a lot AMIN and Lothar