Skip to content

Commit

Permalink
Merge pull request #550 from SumitDixitSD/main
Browse files Browse the repository at this point in the history
Create Squareroot.py
  • Loading branch information
tarunsinghofficial committed Oct 20, 2020
2 parents 0965028 + 4c9600f commit dfcd342
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions Squareroot.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Find square root of real or complex numbers
# Importing the complex math module
import cmath

num = 1+2j

# To take input from the user
#num = eval(input('Enter a number: '))

num_sqrt = cmath.sqrt(num)
print('The square root of {0} is {1:0.3f}+{2:0.3f}j'.format(num ,num_sqrt.real,num_sqrt.imag))

0 comments on commit dfcd342

Please sign in to comment.