Mark As Completed Discussion

type()

We will create the variables of multiple types and check their types using the type function.

PYTHON
1var1 = 5
2var2 = "Minahil"
3var3 = True
4var4 = 0.6
5var5 = 4j

Using the type() function:

PYTHON
1print(type(var1))
2print(type(var2))
3print(type(var3))
4print(type(var4))
5print(type(var5))

The output will be:

PYTHON
1<class 'int'>
2<class 'str'>
3<class 'bool'>
4<class 'float'>
5<class 'complex'>
PYTHON
OUTPUT
:001 > Cmd/Ctrl-Enter to run, Cmd/Ctrl-/ to comment