Skip to content

Conversation

Copilot
Copy link

@Copilot Copilot AI commented Oct 3, 2025

Overview

Added a practical robotics example to demonstrate if-elif-else control flow statements in Python. The new 02_control_flow.py file contains a drone pre-flight battery check scenario that students can easily understand and relate to.

Implementation Details

The file implements a battery percentage check system that provides flight recommendations based on three distinct battery level ranges:

  • Below 25%: Displays a critical warning - "Warning: Battery critically low. Do not fly."
  • 25-75%: Indicates safe operation for limited use - "Battery OK for short flight."
  • Above 75%: Confirms optimal conditions - "Battery optimal. Ready for flight."

Example Output

When running the script with the default battery level of 80%:

Battery optimal. Ready for flight.

Students can easily modify the battery_percentage variable to test different scenarios and observe how the control flow responds to different conditions.

Educational Value

This practical example helps students understand:

  • Conditional logic using if-elif-else statements
  • Real-world applications of control flow in robotics
  • Decision-making processes in autonomous systems
  • Safe operating procedures for robotic platforms

The scenario is directly applicable to RobotX Workshop students working with drones and autonomous vehicles.

Original prompt

Add a Practical Control Flow Scenario
This task tells Copilot to create a realistic decision-making process that a student would encounter in robotics.

In 02_control_flow.py, add a drone pre-flight check scenario.
Use an if-elif-else statement to check a battery_percentage variable.

  • If below 25%, print "Warning: Battery critically low. Do not fly."
  • If between 25% and 75%, print "Battery OK for short flight."
  • If above 75%, print "Battery optimal. Ready for flight."

💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: anjrew <26453863+anjrew@users.noreply.github.com>
@Copilot Copilot AI changed the title Add a Practical Control Flow Scenario This task tells Copilot to create a realistic decision-making process that a student would encounter in robotics. In 02_control_flow.py, add a drone pre-flight check scenario. Use an if-elif-else statement to ... Add drone pre-flight check scenario to demonstrate control flow Oct 3, 2025
@Copilot Copilot AI requested a review from anjrew October 3, 2025 15:52
Copilot finished work on behalf of anjrew October 3, 2025 15:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants