Skip to content

Instantly share code, notes, and snippets.

@emilgaripov
Last active April 28, 2020 13:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save emilgaripov/e57faa57c8083ca47dae4e60e7ad65b6 to your computer and use it in GitHub Desktop.
Save emilgaripov/e57faa57c8083ca47dae4e60e7ad65b6 to your computer and use it in GitHub Desktop.
Paretheses missing
'''
Задание 4.5
Из строк command1 и command2 получить список VLANов,
которые есть и в команде command1 и в команде command2.
Результатом должен быть список: ['1', '3', '8']
Ограничение: Все задания надо выполнять используя только пройденные темы.
'''
command1 = 'switchport trunk allowed vlan 1,2,3,5,8'
command2 = 'switchport trunk allowed vlan 1,3,8,9'
line1 = command1.strip().split()[-1].split(','
line2 = command2.strip().split()[-1].split(',')
vlans = set(line1 + line2)
vlans = sorted(list(vlans))
print(vlans)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment