In [1]:
name = "mike"print(name)mike
In [3]:
name = input("Enter your name : ")print("Welcome", name)Enter your name : Jane
Welcome Jane
- Here in the below piece of code you can see that we have assigned each variable with a particular value and use the type method we can check the datatype of the variable
In [1]:
name = "mike"print(name)mike
In [3]:
name = input("Enter your name : ")print("Welcome", name)Enter your name : Jane
Welcome Jane
- Here in the below piece of code you can see that we have assigned each variable with a particular value and use the type method we can check the datatype of the variable
In [15]:
integer_num = 1floating_num = 1.3string = 'Mike'boolean = Trueprint (type(integer_num))print (type(floating_num))print (type(string))print (type(boolean))<class 'int'>
<class 'float'>
<class 'str'>
<class 'bool'>
- Type Casting in Python
In [4]:
a = 1print ( bool(a))print ( float(a))print ( str(a))True
1.0
1- Get link
- X
- Other Apps
- Get link
- X
- Other Apps
Comments
Post a Comment