How to differentiate int, float, char type variables in python? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to differentiate int, float, char type variables in python?

1st Mar 2018, 3:59 PM
swagat patro
swagat patro - avatar
5 Answers
+ 3
Yes, you can change a variableā€™s type on-the-run. You can also check its type with type().
1st Mar 2018, 9:40 PM
Pedro Demingos
Pedro Demingos - avatar
+ 1
that means I have taken a string variable later on if I want I can assign integer value to it, right??
1st Mar 2018, 4:23 PM
swagat patro
swagat patro - avatar
0
in python you dont need to declare the type for variables eg. this is a string variable: me = 'me' this is an int variable: me = 12345 this is a Boolean variable: me = True
1st Mar 2018, 4:14 PM
Obbu
Obbu - avatar
0
Python does it automatically, but for some applications you might want to ''hard '' define them using: str - string, int - integer etc.
2nd Mar 2018, 9:47 PM
Kārlis Zauers
Kārlis Zauers - avatar