-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain_hw10_12.py
More file actions
34 lines (23 loc) · 995 Bytes
/
main_hw10_12.py
File metadata and controls
34 lines (23 loc) · 995 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
class IDException(Exception):
pass
def add_id(id_list, employee_id):
if not employee_id.startswith('01'):
raise IDException
else:
id_list.append(employee_id)
return id_list
test_str = 'test str'
# if not test_str.startswith('te'):
# print('yes')
# else:
# print('no')
id_list = ['mmm', 'bbbb']
result = add_id(id_list, test_str)
print(result)
"""
Створіть клас IDException, який успадковуватиме клас Exception.
Також реалізуйте функцію add_id(id_list, employee_id), яка додає до списку id_list
ідентифікатор користувача employee_id та повертає вказаний оновлений список id_list.
Функція add_id буде викликати власне виключення IDException, якщо employee_id не
починається з '01', інакше employee_id буде додано до списку id_list.
"""