Python Forum

Full Version: Checking for an item in a list (if then statement)
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I am very new to python. I am trying to check if the first letter of a word is a vowel or not and I have to do so using sets. Here is what I am trying but it isn't working.

My_Word = "cat"
First_Letter = My_Word[0]
vowels = {'a', 'e', 'i', 'o', 'u'}
if First_Letter in vowels == true
From there I get a syntax error. Any help?

Got it... there was a ":"

Go figure
The == true at the end of line 4 is redundant. That is, that line is more naturally written

if First_Letter in vowels:

which also reads quite nicely.