forked from EvgrafovMichail/python_mipt_dafe
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhello.py
30 lines (29 loc) · 955 Bytes
/
hello.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
def check_comand(user_comand: str, comands: list[str]) -> bool:
flag = 0
for comand in comands:
f = False
for a in comand:
for i in range(len(user_comand)):
uc = list(user_comand)
uc[i] = a
if ''.join(uc) == comand:
f = True
break
for i in range(len(user_comand)+1):
uc = list(user_comand)
uc.insert(i, a)
if ''.join(uc) == comand:
f = True
break
for i in range(len(user_comand)):
uc = list(user_comand)
del uc[i]
if ''.join(uc) == comand:
f = True
break
flag += f
if flag == 1:
return True
return False
print(check_comand('gt', ['cd', 'ls', 'git']) )
print(check_comand('gt', ['cd', 'ls', 'git', 'get']))