-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy patherror_handling.py
More file actions
35 lines (30 loc) · 840 Bytes
/
Copy patherror_handling.py
File metadata and controls
35 lines (30 loc) · 840 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
34
35
#!/usr/bin/env python3
import random
'''print('begin')
try:
with open('dne.txt', 'r') as whatever:
pass
print(1/0)
except ZeroDivisionError as ZeroErr:
print(ZeroErr)
print('you tried to divide by zero you goof')
except FileNotFoundError as FileErr:
print(FileErr)
print('you tried to open a file that does not exist you goof')
print('fin')'''
def guess_number(n):
while True:
try:
guess = int(input('Enter a number: '))
except ValueError as ValError:
print('You didn' + "'" + 't provide a number you goof')
print(ValueError)
continue
if guess == n:
print('win')
return
elif guess > n:
print('too high')
else:
print('too low')
guess_number(random.randint(0,100))