-
Notifications
You must be signed in to change notification settings - Fork 1
/
PiDigits.py
36 lines (31 loc) · 857 Bytes
/
PiDigits.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
#!/usr/bin/python3
from scipy import pi
import sys
def retpi(numdig):
num=str(pi)
for dig in range(numdig+1):
yield num[dig]
def getinp():
try:
print(f"How many digits of pi do you want? The maximum number of digits we can give is {len(str(pi))-1}. To exit type 0.")
try:
numdigits=int(input())
except:
print(sys.exec_info[0])
sys.exit()
print(numdigits)
print('Here')
if numdigits==0:
print('called')
print('I hope you found this program useful')
quit()
print('past quit')
else:
print(''.join(list(retpi(numdigits))))
except KeyboardInterrupt:
quit()
except:
print('An error occured try again')
if __name__ == '__main__':
while True:
getinp()