Python program of declaration of variables, demonstrate different datatypes
In this article we will see variables declaration and initialization with different Data Types in Python.
Let’s Look at the Code :-
#Variables declaration and initialization with different Data Type #Declaration numbers a=100 b=56.58 c=20+8j #Declaration strings name="UOR Jaipur" msg = 'hello everyone\nGood Morning' flag = True # declaration Boolean type variable x,y=10,20 # Assigning multiple values to multiple variables p=q=r=40 # Assign a single value to the multiple variables #display variable's result and their type print("the value of a is: ",a,'\nits type is:',type(a)) print("the value of b is: ",b,'\nits type is:',type(b)) print("The type of c", type(c)) print(c) print("the value of b is: ",b,'\nits type is:',type(b)) print("the value of name is: ",name,'\nits type is:',type(name)) print() print(msg) print("the value of flag is: ",flag,'\nits type is:',type(flag)) print('x= ',x, 'y=',y) print('p =', p, '\nq =', q, '\np =', r)
OUTPUT :-
the value of a is: 100 its type is: <class 'int'> the value of b is: 56.58 its type is: <class 'float'> The type of c <class 'complex'> (20+8j) the value of b is: 56.58 its type is: <class 'float'> the value of name is: UOR Jaipur its type is: <class 'str'> hello everyone Good Morning the value of flag is: True its type is: <class 'bool'> x= 10 y= 20 p = 40 q = 40 p = 40