#This program explains complex data types
#Add two complex numbers
c1=3.5+5.2j
c2=2.0+1.3j
c3=c1+c2
print("sum=",c3)
print(type(c3))
print(id(c3))
"""output
F:\Programs\Datatypes>python compl.py
sum= (5.5+6.5j)
F:\Programs\Datatypes>python compl.py
sum= (5.5+6.5j)
<class 'complex'>
F:\Programs\Datatypes>python compl.py
sum= (5.5+6.5j)
<class 'complex'>
11453240
F:\Programs\Datatypes>"""
#Add two complex numbers
c1=3.5+5.2j
c2=2.0+1.3j
c3=c1+c2
print("sum=",c3)
print(type(c3))
print(id(c3))
"""output
F:\Programs\Datatypes>python compl.py
sum= (5.5+6.5j)
F:\Programs\Datatypes>python compl.py
sum= (5.5+6.5j)
<class 'complex'>
F:\Programs\Datatypes>python compl.py
sum= (5.5+6.5j)
<class 'complex'>
11453240
F:\Programs\Datatypes>"""
No comments:
Post a Comment