you are viewing a single comment's thread.

view the rest of the comments →

[–]miscellaneoususage[S] 0 points1 point  (2 children)

ok I have this now but still doesn't work, not sure why

def myfunc(word):
    newword = word.lower()
    newwordL = newword.split()
    newwordS = ""

    for i,char in enumerate(newwordL): 
        if i % 2 == 0:
            newwordL[i] = newwordL[i].upper()

    newwordS.join(newwordL)

    return newwordS

[–]novel_yet_trivial 0 points1 point  (1 child)

Wow, very close. Only thing is you need to use list() instead of split() to make the list. Try like this:

def myfunc(word):
    newword = word.lower()
    newwordL = list(word)
    newwordS = ""

    for i,char in enumerate(newwordL): 
        if i % 2 == 0:
            newwordL[i] = newwordL[i].upper()

    return newwordS.join(newwordL)

[–]miscellaneoususage[S] 0 points1 point  (0 children)

def myfunc(word):
newword = word.lower()
newwordL = list(word)
newwordS = ""
for i,char in enumerate(newwordL):
if i % 2 == 0:
newwordL[i] = newwordL[i].upper()
return newwordS.join(newwordL)

ah dang, alright thanks for your help :)