I'm trying to create a loop that will take what the user entered and print it back alternating between upper and lowercase. Ex: the user enters 'helloworld', it prints back 'HeLlOwOrLd'. Here's what I have so far (trust me, I know it's not optimal, it's just what I could get to work):
s = input("enter characters: ")
word = ''
count = 0
for i in s:
up = s[::2]
up2 = up.upper()
up3 = up2[0 + count]
low = s[1::2]
low2 = low.lower()
low3 = low2[0 + count]
word += up3 + low3
count += 1
print(word)
When I trace it in the debugger, word comes to the right value, and then it runs the loop again, thus getting the index out of range error. Ideas?