0
0
Computer Networksknowledge~30 mins

MAC addressing in Computer Networks - Mini Project: Build & Apply

Choose your learning style9 modes available
Understanding MAC Addressing
📖 Scenario: You are learning about how devices on a local network identify each other using MAC addresses. Each device has a unique MAC address that helps in communication within the network.
🎯 Goal: Build a simple list of devices with their MAC addresses, set a filter to find devices from a specific manufacturer, and then extract those devices' MAC addresses.
📋 What You'll Learn
Create a dictionary called devices with device names as keys and their MAC addresses as values.
Create a variable called manufacturer_prefix that holds the first three pairs of a MAC address to filter devices.
Use a dictionary comprehension called filtered_devices to select devices whose MAC addresses start with manufacturer_prefix.
Add a final step to create a list called filtered_mac_addresses containing only the MAC addresses from filtered_devices.
💡 Why This Matters
🌍 Real World
Network administrators use MAC addresses to identify and manage devices on a local network.
💼 Career
Understanding MAC addressing is essential for roles in IT support, network administration, and cybersecurity.
Progress0 / 4 steps
1
Create the devices dictionary
Create a dictionary called devices with these exact entries: 'Laptop': '00:1A:2B:3C:4D:5E', 'Smartphone': '00:1A:2B:6F:7G:8H', 'Printer': '11:22:33:44:55:66', 'Tablet': '00:1A:2B:9J:0K:1L'.
Computer Networks
Need a hint?

Use curly braces to create a dictionary. Each device name is a key, and its MAC address is the value as a string.

2
Set the manufacturer prefix
Create a variable called manufacturer_prefix and set it to the string '00:1A:2B' to represent the manufacturer part of the MAC address.
Computer Networks
Need a hint?

Assign the string '00:1A:2B' to the variable manufacturer_prefix.

3
Filter devices by manufacturer prefix
Use a dictionary comprehension to create a new dictionary called filtered_devices that includes only the devices from devices whose MAC addresses start with manufacturer_prefix. Use for device, mac in devices.items() and check if mac.startswith(manufacturer_prefix).
Computer Networks
Need a hint?

Use dictionary comprehension with for device, mac in devices.items() and if mac.startswith(manufacturer_prefix).

4
Extract filtered MAC addresses
Create a list called filtered_mac_addresses that contains only the MAC addresses from filtered_devices. Use a list comprehension to get the values from filtered_devices.
Computer Networks
Need a hint?

Use list comprehension to get all MAC addresses from filtered_devices.values().