Last active
April 28, 2020 13:48
-
-
Save emilgaripov/e57faa57c8083ca47dae4e60e7ad65b6 to your computer and use it in GitHub Desktop.
Paretheses missing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
''' | |
Задание 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