# Complex numbers a = 1 + 1j print a*a import math # print math.exp(a) import cmath print cmath.exp(a) print math.exp(1) * math.cos(1) # Conditional statements. # c = input("Complex number : ") c = 1 c = complex(c) print c if c.imag == 0 : if c.real >= 0 : real_root = math.sqrt(c.real) imag_root = 0 else : real_root = 0 imag_root = math.sqrt(-c.real) else : root = cmath.sqrt(c) real_root = root.real imag_root = root.imag print "Square root of the number is %g + %gj." % (real_root, imag_root) #f = input("Enter a real no. : ") f= 0 if f < 0 : f = -f print f # lists : see the other file