Is it possible to set a variable to a string of text, such as “forward” or “reverse”?
Yes
action = “forward”
if “forward” in action:
print("moving forward!) … then all of your movement code.
This lets you do
action = “move forward”
action = “go forward”
and not have things break later on.
If you’re looking to use specifically “forward” and “reverse” for motor movement, an alternative would be to just use negative velocity as it will spin a “forward” set motor reverse and vice versa.