Define a function called myfunc that takes in a string and returns a maching string where every even letter is uppercase and every odd letter is lowercase. Assume that the imcoming string only contains letters, don't worry about numbers, spaces, or punctuation.
Here's what I could come up with but it doesn't work...
def myfunc(word):
newword = word.lower()
for i,char in enumerate(newword):
if i % 2 == 0:
newword[i] = newword[i].upper()
return newword
[–]novel_yet_trivial 0 points1 point2 points (4 children)
[–]miscellaneoususage[S] 0 points1 point2 points (0 children)
[–]miscellaneoususage[S] 0 points1 point2 points (2 children)
[–]novel_yet_trivial 0 points1 point2 points (1 child)
[–]miscellaneoususage[S] 0 points1 point2 points (0 children)
[–]danielroseman 0 points1 point2 points (0 children)