Posted by AnithaKamatchi on Saturday, April 14, 2018 in Python | No comments
pythonNumbers.py
#Python Numbers
num_1 = num_2 = -123 #assigning
same integer value to 2 variables
num_3 = 123.00 #assigning
float value to variable
num_4 = 12.6j #assigning
complex number to variable
num_5 = 127 * -254 * 2.3j
print ("num_1
:", num_1, "\nnum_2 :" ,
num_2, "Type :" , type(num_1))
print ("num_3
:", num_3, "Type :" ,
type(num_3))
print ("num_4
:", num_4 , "Type :" ,
type(num_4))
print ("num_5
:" , num_5, "Type :" ,
type(num_5))
# deleting an object
del num_5
Output:
num_1 : -123
num_2 : -123 Type : <class 'int'>
num_3 : 123.0 Type : <class
'float'>
num_4 : 12.6j Type : <class
'complex'>
num_5 : (-0-74193.4j) Type :
<class 'complex'>

0 comments:
Post a Comment