Skip to content

Commit 0670e29

Browse files
committed
Squre root
1 parent 4bea1bb commit 0670e29

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

Square Root of a number.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
#;==========================================
2+
#; Title: Print Hello World
3+
#; Author: @AyemunHossain
4+
#;==========================================
5+
6+
import math
7+
8+
#Apporach : 1
9+
a = float(input("Enter a number: "))
10+
sq = math.sqrt(a)
11+
12+
print(f"Squre root of {a} : {sq}")
13+
14+
15+
16+
#Apporach : 2
17+
try:
18+
a = float(input("Enter a number: "))
19+
except ValueError:
20+
raise ValueError("Input must be real number")
21+
else:
22+
sq = math.sqrt(a)
23+
print(f"Squre root of {a} : {round(sq,3)}")

0 commit comments

Comments
 (0)