Add robotics-themed functions for drone operations #4
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR implements two reusable robotics-themed functions in
03_functions.py
for the RobotX Workshops Python coding examples collection.Changes
Created
03_functions.py
with the following functions:1.
calculate_distance(speed, time)
Calculates the distance traveled by a drone given its speed and flight time.
Parameters:
speed
(float): Speed in meters per secondtime
(float): Time in secondsReturns: Distance traveled in meters
Example:
2.
format_sensor_data(x, y, z)
Formats sensor position data into a human-readable string representation.
Parameters:
x
,y
,z
(float): Coordinate valuesReturns: Formatted string like
"Position: (x=10, y=20, z=5)"
Example:
Demo Output
When running
python3 03_functions.py
, the following demonstration output is displayed:Both functions include comprehensive docstrings with parameter descriptions, return types, and usage examples following Python best practices.
Original prompt
💬 Share your feedback on Copilot coding agent for the chance to win a $200 gift card! Click here to start the survey.