forked from mkarwat/bad-practises
-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
41 lines (32 loc) · 919 Bytes
/
main.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
from my_ops import PiContainer, calc_pi
def enumerate_pi(pi):
for index in pi.my_pies:
print(f'Next element: {index}')
def main():
try:
my_pi = PiContainer()
ctr = 5
pi_gen = calc_pi(approx_level=ctr)
for next_pi in pi_gen:
my_pi.mth(next_pi)
except ValueError as e:
print(e)
raise e
except (FileNotFoundError, EOFError) as e:
raise e
pi_gen = calc_pi(approx_level=194)
my_pi_2 = PiContainer()
required_level=23
for _ in range(required_level):
my_pi_2.mth(next(pi_gen))
my_pi_3 = PiContainer()
pi_gen = calc_pi(approx_level=6)
my_pi_3.mth(list(pi_gen))
print('my first pi:')
enumerate_pi(my_pi)
print('my second pi:')
enumerate_pi(my_pi_2)
with open('some-file.txt', 'w') as f:
f.write(f'my best pi: {my_pi_3.best}')
if __name__ == "__main__":
main()