-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathexception.py
More file actions
33 lines (23 loc) · 786 Bytes
/
exception.py
File metadata and controls
33 lines (23 loc) · 786 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
29
30
31
32
33
import array as numbers
numbers=(['a',0,5])
reciprocals=(['a',0,5])
try:
for val in numbers:
print("\nThe values of the reciprocals are:\n")
try:
for i in range(10):
reciprocals[i] = 1.0 / numbers[i]
print("%15.2lf", reciprocals[i])
except BaseException:
print("reciprocals are given.")
except:
print("first loop completed")
for i in range(0, 6,1):
try:
sum += reciprocals[i]
if (i > 0):
print(" + ")
print("1/%.2lf", numbers[i])
print(" = %lf\n", sum)
except:
print("Done")