-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLR11_5.py
More file actions
25 lines (23 loc) · 941 Bytes
/
Copy pathLR11_5.py
File metadata and controls
25 lines (23 loc) · 941 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
# 11 ЛР.Задание 5.
permissions = {} #словарь,где храним имена файлов и атрибуты
print("Введите количество файлов в файловой системе:")
n = int(input())
print("Введите файл и режим доступа:")
for _ in range(n):
s = input().split()
permissions[s[0]] = set(s[1:])#собираем словарь:ключ - имя файла, значение - право доступа
print("Введите количество файлов в файловой системе:")
m = int(input())
print("Введите файл и операцию над ним:")
for _ in range(m):
perm,file = input().split()
if perm == 'read':
perm = 'R'
if perm == 'write':
perm = 'W'
if perm == 'execute':
perm = 'X'
if perm in permissions[file]:
print('OK')
else:
print('Access denied')