I am a beginner in Python trying to make a function that will capitalize all of the values with an even index, and make lowercase all of the values with an odd index.
You are returning in the first iteration of the loop.
Append the alphabets in a list and return concatinated. Also add 1 to a while checking condition if you want even index to capitalize as the index starts from 0. Use below example:
def func1(x):
result = []
for (a,b) in enumerate (x):
if (a+1)%2 == 0:
result.append(b.upper())
else:
result.append(b.lower())
return "".join(result)
print func1('Testing Testing')
Output:
tEsTiNg tEsTiNg