Q:

For loop Lists function

def f(p):
    z=len(p)
    for y in range(0,z):
        if "t" in p[y]:
            print(p[y])
    return
list = ["titan","ton", "automatic","manual"]
f(list)

The function is supposed to remove all words that begin with the letter ‘t’ from the list.  The function then returns that list. This function just returns a list with all words with t in them.

A:

Your problem is twofold:

You are not removing the items from the list in your function.
You are not returning anything from the function; namely, the filtered list.

However, you don't need a function that big for this job.  Just use a list comprehension to filter out those items:
>>> lst = ["titan","ton", "automatic","manual"]
>>> def func(lst):
...     # You could also do `[x for x in lst if not x.lower().startswith("t")]`
...     # which will also capture words starting with "T"
...     return [x for x in lst if not x.startswith("t")]
...
>>> # Reassign 'lst' to the cleaned list
>>> lst = func(lst)
>>> lst
['automatic', 'manual']
>>>

A:

Your function returns None, although it prints out all the words with "t" in them.  What you want is something like 
def f(p):
    no_ts = []
    for el in p:
        if not el.startswith("t"):
            no_ts.append(el)
    return no_ts

It can be easily done with a list comprehension
[el for el in p if not el.lower().startswith("t")]
# .lower() makes sure to catch words that start with "T"

Also, it's best if you don't confuse the namespace by naming variables with reserved names like "list" or "str".

