Depending on the user input, your CoDrone will fly a different pattern! The best way to set this up is with conditionals. Have your drone take off, and then for option 1, set up an if statement and include your drone’s maneuver.
if option == 1:
For options 2 through 4, use else if statements, and then include drone maneuvers.
elif option == 2:
elif option == 3:
elif option == 4:
For option 5, use another else if statement again, but include a print command that says, “You have quit the menu” and then a break. This will exit the loop.
elif option == 5:
print("You have quit the menu.")
Next, include an else statement that will work when an invalid user input (like a number outside of 1-5) is entered. This is not necessary, but it is good programming practice to provide feedback to the user when they have input something incorrect.
print("Not a valid input. Try again.")
Finally, have your drone land and then (this is optional) include a print command that says “Done.”