Last active
April 28, 2020 13:48
-
-
Save emilgaripov/5b7de91813d50e7c6c679d62e4fe1fac to your computer and use it in GitHub Desktop.
Print Statement
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