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
''' | |
Задание 5.2 | |
Запросить у пользователя ввод IP-сети в формате: 10.1.1.0/24 | |
Затем вывести информацию о сети и маске в таком формате: | |
Network: | |
10 1 1 0 | |
00001010 00000001 00000001 00000000 |
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
Введите ip адрес в формате a.a.a.a/b: | |
--------------------------------------------------------------------------- | |
ValueError Traceback (most recent call last) | |
<ipython-input-3-db031a33a5cb> in <module> | |
22 ip = input('Введите ip адрес в формате a.a.a.a/b: ') | |
23 ip = ip.strip().split('.') | |
---> 24 oct_1, oct_2, oct_3 = int(ip[0]), int(ip[1]), int(ip[2]) | |
25 oct_4 = int(ip[-1].strip().split('/')[0]) | |
26 mask = int(ip[-1].strip().split('/')[1]) |
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
''' | |
Задание 5.2 | |
Запросить у пользователя ввод IP-сети в формате: 10.1.1.0/24 | |
Затем вывести информацию о сети и маске в таком формате: | |
Network: | |
10 1 1 0 | |
00001010 00000001 00000001 00000000 |
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.7 | |
Преобразовать MAC-адрес mac в двоичную строку такого вида: | |
'101010101010101010111011101110111100110011001100' | |
Ограничение: Все задания надо выполнять используя только пройденные темы. | |
''' |
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
AAAABBBBCCCC <class 'str'> | |
--------------------------------------------------------------------------- | |
TypeError Traceback (most recent call last) | |
<ipython-input-3-ceea58998966> in <module> | |
13 mac_ = ''.join(mac_) | |
14 print(mac_, type(mac_)) | |
---> 15 mac_ = bin(mac_) | |
16 mac_ = mac_.lstrip('0b') | |
17 print(mac_) |
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.7 | |
Преобразовать MAC-адрес mac в двоичную строку такого вида: | |
'101010101010101010111011101110111100110011001100' | |
Ограничение: Все задания надо выполнять используя только пройденные темы. | |
''' |
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
--------------------------------------------------------------------------- | |
TypeError Traceback (most recent call last) | |
<ipython-input-2-24a72a1aa1d6> in <module> | |
12 mac_ = mac.strip().split(':') | |
13 mac_ = ''.join(mac_) | |
---> 14 mac_ = bin(mac_) | |
15 mac_ = mac_.lstrip('0b') | |
16 print(mac_) | |
TypeError: 'str' object cannot be interpreted as an integer |
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.7 | |
Преобразовать MAC-адрес mac в двоичную строку такого вида: | |
'101010101010101010111011101110111100110011001100' | |
Ограничение: Все задания надо выполнять используя только пройденные темы. | |
''' |
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
File "<ipython-input-26-df69e49a2452>", line 17 | |
vlans = set(line1 + line2) | |
^ | |
SyntaxError: invalid syntax |
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
File "<ipython-input-26-df69e49a2452>", line 17 | |
vlans = set(line1 + line2) | |
^ | |
SyntaxError: invalid syntax |