-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathtemporary.py
46 lines (41 loc) · 824 Bytes
/
temporary.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
36
37
38
39
40
41
42
43
44
45
46
num = 0
tot = 0.0
while True:
sval = input('Enter a number: ')
if sval == 'done':
break
try:
fval = float(sval)
except:
print('invalid input')
continue
print(fval)
num = num + 1
tot = tot + fval
print('All done')
print(tot, num, tot/num)
largest = None
smallest = None
while True:
num = input("Enter a number: ")
if num == "done":
break
try:
int(num)
except:
print('Invalid input')
continue
print(largest)
print(num)
if largest is None:
largest = num
elif num >= largest:
largest = num
if smallest is None:
smallest = num
elif num < smallest:
smallest = num
print(largest)
print(smallest)
print("Maximum is", largest)
print('Minimum is', smallest)