def Command_Open(): return def Command_Save(): return def Command_Print(): return def Command_New(): return # The problem with previous versions of the command processor # is that command "OPEN" is legal but command "open" is not. # By using the .upper() method on strings, we can capitalize the # user's input, and test against only the upper case version. # The user could enter "open", "OPEN", "Open", "oPeN", or any # other variant, and it will always be treated as "OPEN". def Main(): MoreToDo = True while MoreToDo: Command = input("Enter a command --- ") Command = Command.upper() # Capitalize string if Command == "QUIT": MoreToDo = False elif Command == "OPEN": Command_Open() # Call stub elif Command == "SAVE": Command_Save() # Call stub elif Command == "PRINT": Command_Print() # Call stub elif Command == "NEW": Command_New() # Call stub elif Command == "EDIT": pass # Do nothing, replace with stub call later elif Command == "COPY": pass # Do nothing, replace with stub call later else: print ("Illegal Command") return