I am able to perform the capitalization function using the below for loop and enumerate function.
wordlist = list(word)
for i,v in enumerate(wordlist):
if i%2 != 0:
wordlist[i] = v.upper()
else:
wordlist[i] = v.lower()
word2 = "".join(wordlist)
print(word2)
However when I try to put it into the function in python, I am not able to reproduce the same result as above:
def myfunc(*word):
wordlist = list(word)
for i,v in enumerate(wordlist):
if i%2 != 0:
wordlist[i] = v.upper()
else:
wordlist[i] = v.lower()
word = "".join(wordlist)
return (word)
Can anyone help me with my question?