I'm trying to scroll through one string and add each character to another string to create a new string.
I have the following function
def rocConvert(self, s):
newString = ""
for c in s:
if c.isupper():
newString += c
elif c.islower():
newString += c
else:
newString += c
return newString
For some reason this is only returning the first char of s. Note, I realize my method is kind of weird for just copying: my end function willl actually be changing the value if it's a lower or upper case character.
Why is this only returning the first character of s?
-tt, i.e.python -tt your_program_name.py. Possibly there's a mixed tabs-and-spaces issue, so yourreturnis actually indented inside theforloop, even though it may not look like it.