-> converted un-changed lists into tuples for better runtime & memory savings.
-> replaced quit() by sys.exit().
-> created a constant 'EMPTY' for storing repeating tuple occurrences.
-> removed unnecessary '!=0' & '==0' references in conditional statements.
-> removed str conversion after input as if already returns a string.
-> switched .lower().strip() -> .strip().lower() for better performance.
-> some other minor optimizations.
Made the following changes:
-> converted un-changed lists into tuples for better runtime & memory savings. -> replaced quit() by sys.exit(). -> created a constant 'EMPTY' for storing repeating tuple occurrences. -> removed unnecessary '!=0' & '==0' references in conditional statements. -> removed str conversion after input as if already returns a string. -> switched.lower().strip() -> .strip().lower() for better performance.
-> some other minor optimizations.