input: Write a python function named 'count_vowels' that accepts a string input representing a word and counts the number of vowels in it. For this function, consider 'a', 'e', 'i', 'o', 'u' as vowels, and treat 'y' as a vowel only when it appears at the end of the word.
  assert count_vowels("abcde") == 2
  assert count_vowels("Alone") == 3
  assert count_vowels("key") == 2
  assert count_vowels("bye") == 1
  assert count_vowels("keY") == 2
  assert count_vowels("bYe") == 1
  assert count_vowels("ACEDY") == 3
output: def count_vowels(word):
      vowels = set('aeiouAEIOU')
      count = 0
      for index, char in enumerate(word):
          if char in vowels or (char in 'yY' and index == len(word) - 1):
              count += 1
      return count