Setting a data type

define setting a data type with example.

Hiii @ Jhasim S,
In python unlike other programming language you don’t explicitly define a datatype, python do it implicitly but still if you want to define a data type explicitly you can do that by simply writing the name of data type before the value while defining it. for e.g.
number = 10
print(type(number))
(when you check data type of “number” , it will show you “int” , This is called implicitly defining data type of the variable.)
number = str(10)
print(type(number))
(when you again check data type of “number” , it will show you “str” , This is called explicit type casting .)

1 Like