+ 1
Query related data type
Why only float is used as a data type in python?
2 Réponses
+ 23
It depends on how u declare the variable or what values you assign to it
x = "Hi" will be string
x= 3.14 will be float
x= 3 will be int
you can convert float to int
x=int(x)
If your question was why it was made to take float as default/output is in float by default then i guess because it makes things easy.. I mean who would want to declare the type always..
+ 1
Thank you