-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSolution(x+y).py
35 lines (33 loc) · 1.3 KB
/
Solution(x+y).py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
while True:
while True:
try:
num1 = int(input('\nEnter First number:'))
except ValueError:
print("\nPlease enter only number")
else:
break
while True:
try:
num2 = int(input('\nEnter Second number:'))
except ValueError:
print("\nPlease enter only number")
else:
break
sol=(num1+num2)*(num1+num2)
print("\nThe Solution is {}.".format(sol))
#print("\nThe Solution is",str(sol) + '.')
#print(f"\nThe Solution is {sol}.")
while True:
Repeat=input("\nDo you want to calculate again?\n\nYes or No:")
Repeat=Repeat.lower()
if Repeat not in ["yes","y","no","n"]:
print("\nPlease select correct option")
else:
break
if Repeat in ["yes","y"]:
continue
else:
if Repeat in ["no","n"]:
print("\n-----Thank you for using-----")
input()
break