state pattern win addstr( ""win move( while truech win getch(if ch is not nonewin move( win deleteln(win addstr( ""if ch = break elif ch = print("running left"elif ch = print("running right"elif ch = print("jumping"elif ch = print("crouching"elseprint("standing"time sleep( if __name__ ="__main__"main(as an exerciseyou can expand upon this code using the pygame module from to create character that can run and jump on the screen instead of just printing out the action the character is currently taking it might be useful to look at the pygame documentation to see how to load sprite image from file (sprite sheetinstead of just drawing simple block on the screen by this timeyou know that the if statement we use to determine what to do with the input is problem it smells bad to your code sense since state diagrams are such useful representations of object-oriented systemsand the resulting state machines are widespreadyou can be sure that there is design pattern to clean up this code smell the design pattern you are looking for is the state pattern