📖 Scenario: You are learning about drones, also called UAVs (Unmanned Aerial Vehicles). Drones are flying machines controlled by computers or remote controls. They can take pictures, deliver packages, or help in emergencies.
🎯 Goal: Build a simple program that stores basic information about a drone and then shows that information.
📋 What You'll Learn
Create a dictionary with drone details
Add a variable for drone flight time
Use a loop to list all drone features
Print the drone information clearly
💡 Why This Matters
🌍 Real World
Drones are used in photography, delivery, farming, and rescue missions. Programming drones helps control their actions and gather data.
💼 Career
Understanding drone data structures and loops is useful for drone software developers, robotics engineers, and tech enthusiasts working with UAVs.
Progress0 / 4 steps
1
Create a dictionary with drone details
Create a dictionary called drone with these exact entries: 'name': 'SkyExplorer', 'type': 'Quadcopter', 'features': ['Camera', 'GPS', 'Auto-landing']
Drone Programming
Hint
Use curly braces {} to create a dictionary. Put keys and values inside.
2
Add a variable for drone flight time
Create a variable called flight_time and set it to 30 (minutes) to represent how long the drone can fly.
Drone Programming
Hint
Just write flight_time = 30 on a new line.
3
Use a loop to list all drone features
Use a for loop with variable feature to go through drone['features'] and print each feature.
Drone Programming
Hint
Use for feature in drone['features']: and then print inside the loop.
4
Print the drone information clearly
Print the drone's name, type, and flight_time in a friendly sentence using an f-string.
Drone Programming
Hint
Use print(f"The drone {drone['name']} is a {drone['type']} and can fly for {flight_time} minutes.").
Practice
(1/5)
1. What is a drone (UAV)?
easy
A. A flying robot controlled remotely or by code
B. A type of ground vehicle
C. A software program for computers
D. A stationary camera device
Solution
Step 1: Understand the definition of a drone
A drone, also called UAV, is a flying machine that can be controlled remotely or by programming.
Step 2: Compare options with the definition
Only A flying robot controlled remotely or by code matches this description; others describe different things.
Final Answer:
A flying robot controlled remotely or by code -> Option A
Quick Check:
Drone = flying robot [OK]
Hint: Remember: drone means flying robot [OK]
Common Mistakes:
Confusing drone with ground vehicles
Thinking drone is just software
Mixing drone with cameras
2. Which of these is the correct way to start a drone flying using code?
easy
A. drone.fly()
B. drone.takeoff()
C. drone.land()
D. drone.stop()
Solution
Step 1: Identify the command to start flying
The command takeoff() is used to make the drone lift off the ground.
Step 2: Check other commands
fly() is not a standard command; land() and stop() are for ending flight or stopping.
Final Answer:
<code>drone.takeoff()</code> -> Option B
Quick Check:
Takeoff starts flight [OK]
Hint: Takeoff means start flying [OK]
Common Mistakes:
Using fly() instead of takeoff()
Confusing land() with takeoff()
Using stop() to start flying
3. What will this code print if the drone successfully takes off and lands?