-1

I'm beginning python and this seems like it should simple but cant crack it.

I have to create a list with the alphabet in it then print whether each item is a vowel or consonant. I could use some help. Right now it just tells me that every letter is a consonant. Thank you.


alphabet =['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

for letter in alphabet:
    if letter in alphabet == ['a','e','i','o','u']:
        print (f'{letter} is a vowel')
    else:
        print(f'{letter} is a consonant')

  • 1
    yeah you don't need to do in alphabet == ['a','e','i','o','u'], just if letter in ['a','e','i','o','u'] – Saif Rahman Apr 30 '21 at 16:22
  • Try using ordinary English words to explain how you want `letter` to relate to the list of vowels. Notice how you *don't* mention the word "alphabet"? Notice how you use the word "in" immediately before describing the list? Notice how you use the word "letter" almost directly before "in"? The Python syntax is similar. – Karl Knechtel Apr 30 '21 at 16:27

1 Answers1

1

I don't know what the point of if letter in alphabet == ['a','e','i','o','u'] is.

Instead, try something like this.

alphabet =['a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z']

for letter in alphabet:
    if letter in ['a','e','i','o','u']:
        print (f'{letter} is a vowel')
    else:
        print(f'{letter} is a consonant')
Buddy Bob
  • 5,829
  • 1
  • 13
  • 44