Every Other Letter


this is the exercise link

why my code is not working correctly?

def every_other_letter(word):
  present =[]
  for letter in word:
    if letter in word:
      return present

# Uncomment these function calls to test your function:
# should print Cdcdm

It only returns “C”

Note that the return statement immediately exits the function when it is executed.

what should i use it instead to show with the given output?

Whilst you still want to return something from your function you need to consider when that action should be performed in order to obtain the output you need.