Just like the user input menu, you need to use if, else if, and else statements to have your drone fly in different directions based on the user input. For the w key, use an if statement and then include a command for your drone to throttle up. In the parameters, use the power variable, which will have the drone move at 40% power.
if direction == "w":
For the other 7 flight commands, use else if statements. If you want the drone to go to the left, down, or backwards, put a negative sign next to the power variable in the parameters.
elif direction == "s":
elif direction == "a":
elif direction == "d":
elif direction == "i":
elif direction == "k":
elif direction == "j":
elif direction == "l":
Write one more else if statement for the quit option. This will wait so the landing command isn’t skipped, land the drone, and break out of the loop.
elif direction == "q":
Include an option that will let the user know they made a mistake if they input something that isn’t an option in the program.
print("Not a command")
Finally, include a delay and a move command with one second in the parameters. This is what will actually move the drone, along with the code you wrote for each key!
Outside of the loop, include a print command so you know when you’ve exited the program.