Q:

How do I get this pig latin code to function?

This pig latin code I made seems to be fine, but it asks for input and then outputs the input itself. What's wrong here?
def pig_latin(string_x):
    word_list=string_x.split()
    for item in word_list:
        if (item[:1]).lower() in ["a",'e','i','o','u']:
            item+='ay'
        else:
            item=item[1:]+item[:1]+'ay'
    print(" ".join(word_list))

x=input()
pig_latin(x) 

A:

When you assign to item, you are changing the variable item, but not the value of that element in the list. You want something like:
def pig_latin(string_x):
    word_list=string_x.split()
    new_word_list = []
    for item in word_list:
        if (item[:1]).lower() in ["a",'e','i','o','u']:
            new_word_list.append(item+'ay')
        else:
            new_word_list.append(item[1:]+item[:1]+'ay')
    print(" ".join(new_word_list))

x=input()
pig_latin(x) 

