Determine variable type in Python
To get the type of a variable in python you can use the built in type() method.
In the following code we are printing the value the data type of variable x.
print("variable is integer")
print("variable is string")
print("variable is float")
If you execute the code above then the following will be printed:
variable is integer
try changing the value of x to different types such as string,float.To set float value you can assign x as:
Similarly to assign string to x: