+ 1

Query related data type

Why only float is used as a data type in python?

25th Feb 2018, 5:31 PM
Pragya Singh
Pragya Singh - avatar
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..
25th Feb 2018, 5:50 PM
Frost
Frost - avatar
+ 1
Thank you
26th Feb 2018, 1:13 AM
Pragya Singh
Pragya Singh - avatar