Remove this statement from the function ...
x= ["fizz", "dog", "fizz", "pie", "fizz"]
Place it outside the function. It should not be indented, otherwise it will be part of the function.
Also remove this
print statement from the function, as it follows the
return statement, and can never execute ...
Then, at the end of your code, the following statement can call the function and display the result ...
Be sure not to indent that final statement, otherwise it will be part of the function definition.