-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.py
More file actions
29 lines (19 loc) · 679 Bytes
/
app.py
File metadata and controls
29 lines (19 loc) · 679 Bytes
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
from alpha_pkg.sum_in_range import *
while True:
try:
x = int(input("Please enter integer >= 0 and < 100: "))
if x <= 0 or x > 100:
raise ValueError
range = range_sum(x)
recursive = recursive_sum(x)
math = math_sum(x)
print("Range method => " + str(range))
print("Recursive method => " + str(recursive))
print("Arithmetic method => " + str(math))
if range == recursive == math:
print("Calculated correctly")
else:
print("Invalid calculation")
break
except ValueError:
print("That was not a valid number. Try again")