################################################################ # PROGRAM Remove Everything Except "a" ################################################################ TheString1 = "The rain in Spain lies mainly in the plain" NewString1 = "" TheKeepList1 = {'a'} for EachLetter1 in TheString1.lower(): if EachLetter1 in TheKeepList1: NewString1 = NewString1 + EachLetter1 # Else # Don't do anything # EndIf # EndFor print("This program removes everything except the a's: ") print(NewString1) print(" ") ################################################################ # PROGRAM Remove All The "a"s ################################################################ TheString2 = "The rain in Spain lies mainly in the plain" NewString2 = "" TheKeepList2 = {'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z', ' '} for EachLetter2 in TheString2.lower(): if EachLetter2 in TheKeepList2: NewString2 = NewString2 + EachLetter2 # Else # Don't do anything # EndIf # EndFor print("This program removes all the a's: ") print(NewString2) ################################################################