📖 Scenario: You are learning about cellular networks used in mobile phones and devices. These networks connect devices wirelessly to the internet and to each other. 4G and 5G are two common generations of these networks, each with different features and speeds.Imagine you want to organize information about these networks to understand their differences and uses.
🎯 Goal: Build a simple data structure that holds key facts about 4G and 5G networks. Then, add a filter to find networks that support a certain feature. Finally, create a summary list of network names that meet the filter criteria.
📋 What You'll Learn
Create a dictionary with exact keys '4G' and '5G' and their feature details
Add a variable to hold a feature to search for
Use a loop or comprehension to find networks supporting that feature
Create a final list of network names that support the feature
💡 Why This Matters
🌍 Real World
Cellular networks like 4G and 5G are everywhere, powering mobile internet and communication. Understanding their features helps in choosing devices and services.
💼 Career
Network engineers, mobile app developers, and tech support professionals benefit from knowing how cellular networks differ and how to organize this information.
Progress0 / 4 steps
1
Create the cellular networks data
Create a dictionary called cellular_networks with two keys: '4G' and '5G'. Each key should map to another dictionary with these exact entries: 'speed': 'up to 1 Gbps' and 'latency': 'around 50 ms' for 4G, and 'speed': 'up to 20 Gbps' and 'latency': 'around 1 ms' for 5G.
Computer Networks
Hint
Use a dictionary with keys '4G' and '5G'. Each key's value is another dictionary with 'speed' and 'latency' keys.
2
Set the feature to search for
Create a variable called search_feature and set it to the string 'latency'.
Computer Networks
Hint
Just assign the string 'latency' to the variable search_feature.
3
Find networks supporting the feature
Create a list called networks_with_feature that contains the names of networks from cellular_networks where the inner dictionary has the key equal to search_feature. Use a list comprehension with for network in cellular_networks.
Computer Networks
Hint
Use a list comprehension to check if search_feature is a key in each network's dictionary.
4
Create a summary list of network names
Create a variable called summary and set it to the list networks_with_feature. This will hold the final list of network names that support the feature.
Computer Networks
Hint
Assign the list networks_with_feature to the variable summary.
Practice
(1/5)
1. What is the main advantage of 5G over 4G in cellular networks?
easy
A. Faster speeds and lower delay
B. Longer battery life for devices
C. Better voice call quality only
D. Uses older technology standards
Solution
Step 1: Understand 4G and 5G basics
4G provides fast internet and good connectivity for most uses.
Step 2: Compare 5G features
5G improves speed significantly and reduces delay (latency), allowing more devices to connect smoothly.
Final Answer:
Faster speeds and lower delay -> Option A
Quick Check:
5G speed & latency = Faster and lower [OK]
Hint: 5G is about speed and delay, not just calls [OK]
Common Mistakes:
Thinking 5G only improves call quality
Confusing battery life improvements with network speed
Assuming 5G uses older technology
2. Which of the following is the correct way to describe 4G technology?
easy
A. A wired internet connection
B. A type of computer processor
C. A wireless network technology for mobile devices
D. A software application for phones
Solution
Step 1: Identify 4G technology type
4G is a wireless network technology that connects mobile devices to the internet.
Step 2: Eliminate incorrect options
It is not wired, not a processor, and not software but a network standard.
Final Answer:
A wireless network technology for mobile devices -> Option C
Quick Check:
4G = Wireless network tech [OK]
Hint: 4G connects phones wirelessly, not wired [OK]
Common Mistakes:
Confusing 4G with hardware components
Thinking 4G is software
Assuming 4G means wired internet
3. Consider this code snippet simulating network speed check:
Since network == "5G" is true, speed is assigned 1000.
Final Answer:
1000 -> Option B
Quick Check:
network == "5G" -> speed = 1000 [OK]
Hint: Check condition true? Then speed = 1000 [OK]
Common Mistakes:
Assuming speed is 100 by default
Confusing variable names with output
Expecting syntax error due to inline if
4. This code tries to print the network type but has an error:
network = 4G
print(network)
What is the error and how to fix it?
medium
A. No error, code runs fine
B. print() function is missing parentheses
C. Variable name 'network' is invalid
D. 4G should be in quotes to be a string
Solution
Step 1: Identify the error in variable assignment
4G is not in quotes, so Python treats it as a variable, causing an error.
Step 2: Fix by adding quotes
Put "4G" in quotes to make it a string: network = "4G".
Final Answer:
4G should be in quotes to be a string -> Option D
Quick Check:
Strings need quotes in Python [OK]
Hint: Strings must be in quotes to avoid errors [OK]
Common Mistakes:
Forgetting quotes around text
Thinking print() needs no parentheses
Assuming variable names can't be 'network'
5. A city wants to upgrade its cellular network to support many smart devices with very low delay. Which technology should they choose and why?
hard
A. 5G, because it supports more devices and has lower latency
B. 4G, because it is widely available and fast enough
C. 3G, because it uses less power
D. Wi-Fi, because it covers large outdoor areas
Solution
Step 1: Understand the city's needs
The city needs to support many smart devices with very low delay (latency).
Step 2: Compare network technologies
4G is fast but 5G supports many more devices simultaneously and has much lower latency. 3G is outdated and Wi-Fi does not cover large outdoor areas well.
Final Answer:
5G, because it supports more devices and has lower latency -> Option A
Quick Check:
Many devices + low delay = 5G [OK]
Hint: More devices + low delay = choose 5G [OK]
Common Mistakes:
Choosing 4G for large device support
Confusing Wi-Fi coverage with cellular
Picking older 3G technology
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.