# Author: James Tam # Version: October 25, 2022 # Learning: illustrating how incorrectly formed for-loops by including an # an equivalent while-loop. #Error handling while-loop prevents the program from proceeding until non-empty #string entered. EMPTY = "" aStr = EMPTY while (aStr == EMPTY): aStr = input("Type in a sequence of charcters: ") print("You typed in '%s'" %aStr) #Inappropriately replacing a loop with a branch aStr = EMPTY if (aStr == EMPTY): aStr = input("Type in a sequence of charcters: ") print("You typed in '%s'" %aStr)