Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 15 additions & 0 deletions 02_control_flow.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
"""
Control Flow Example: Drone Pre-Flight Check
This example demonstrates if-elif-else statements using a practical robotics scenario.
"""

# Drone pre-flight check scenario
battery_percentage = 80 # Example value - you can change this to test different conditions

# Check battery level and provide flight recommendation
if battery_percentage < 25:
print("Warning: Battery critically low. Do not fly.")
elif battery_percentage <= 75:
print("Battery OK for short flight.")
else:
print("Battery optimal. Ready for flight.")