Another alternating-case in-a-string in Python 3.+
I'm very new to Python and am trying to understand how to manipulate strings. What I want to do is change a string by removing the spaces and alternating the case from upper to lower, IE "This is harder than I thought it would be" to "ThIsIsHaRdErThAnItHoUgHtItWoUlDbE" I've cobbled together a code to remove the spaces (heavily borrowed from here): string1 = input("Ask user for something.") nospace = "" for a in string1: if a == " ": pass else: nospace=nospace+a ... but just can't get my head around the caps/lower case part. There are several similar issues on this site and I've tried amending