<PLEASE USE THE FOLLOWING TEMPLATE TO HELP YOU CREATE A GREAT POST!>
<Below this line, add a link to the EXACT exercise that you are stuck at. The query string (? and beyond) may be truncated.>
<In what way does your code behave incorrectly? Include ALL error messages.>
I’ve been stuck on this problem for a while. I love CodeAcademy, but I’ve finished the courses I’m interested in so I’ve started using other sites to continue practicing. I still use CodeAcademy labs to run my code, but now that I’m running into problems, I need help and I’m not comfortable posting on the elitist StackOverflow (had a bad experience).
Basically, I can’t figure out how to take out the white space between characters as I iterate over a string.
In the example below, I’m trying to iterate over a string and switch the case from upper to lower or vice versa. Right now my code prints out the right cases, but with a space between each character. I’ve tried looking up solutions on StackOverflow and I’ve seen people suggesting removing white space with “”.join() or str.split() but I can’t seem to figure it out. Any help would be great
result = ‘’
for x in string:
**EDIT: This is how I edited my code that passed:** ```python def to_alternating_case(string): result = '' for x in string: if x.isupper(): result += x.lower() else: result += x.upper() return result