0
0
Drone Programmingprogramming~15 mins

Altitude limits configuration in Drone Programming - Mini Project: Build & Apply

Choose your learning style9 modes available
Altitude Limits Configuration
📖 Scenario: You are programming a drone to fly safely within certain altitude limits. The drone must not fly below the minimum altitude or above the maximum altitude to avoid obstacles and legal restrictions.
🎯 Goal: Build a program that sets altitude limits, checks if a given altitude is within those limits, and prints whether the altitude is safe or not.
📋 What You'll Learn
Create a dictionary called altitude_limits with keys 'min' and 'max' and values 100 and 500 respectively.
Create a variable called current_altitude and set it to 350.
Write an if statement that checks if current_altitude is between altitude_limits['min'] and altitude_limits['max'] inclusive.
Print "Altitude is within safe limits." if the altitude is safe, otherwise print "Altitude is out of safe limits!".
💡 Why This Matters
🌍 Real World
Drones must fly within safe altitude limits to avoid collisions and comply with regulations.
💼 Career
Understanding how to configure and check limits is important for drone software developers and engineers working on autonomous flying devices.
Progress0 / 4 steps
1
Set altitude limits
Create a dictionary called altitude_limits with keys 'min' and 'max' and values 100 and 500 respectively.
Drone Programming
Need a hint?

Use curly braces {} to create a dictionary with keys and values.

2
Set current altitude
Create a variable called current_altitude and set it to 350.
Drone Programming
Need a hint?

Use a simple assignment to create the variable.

3
Check altitude limits
Write an if statement that checks if current_altitude is between altitude_limits['min'] and altitude_limits['max'] inclusive.
Drone Programming
Need a hint?

Use chained comparison operators to check the range.

4
Print safety status
Print "Altitude is within safe limits." if the altitude is safe, otherwise print "Altitude is out of safe limits!".
Drone Programming
Need a hint?

Use a print statement inside an if-else to show the message.