Working on loops and sequences

Hey to everyone,

I’m starting to work with loops at the bootcamp and I think I get the main idea. But one thing is puzzling me. Down below your find a piece of code from the course .

My question is: how do python know what I mean with ‘word’ or ‘letter’? I mean, I assign a list to a variable and say ‘give me {word} back’ but word isn’t defined somewhere. I think I can live without knowing, but if there is someone who can explain it to me, I would be very happy.

(I looked the ‘in’ fuction up as we used it in the course so far and I think there is no explanation for my problem here, isn’t it?)

Thank you in advance!

words = ['sky', 'apple', 'rhythm', 'fly', 'orange']

for word in words:
    for letter in word:
        if letter.lower() in 'aeiou':
            print(f"'{word}' contains the vowel '{letter}'")
            break
    else:
        print(f"'{word}' has no vowels")

Hi @patrick.weissler,

You are actually defining word or letter to be a temporary identifier that will hold the value of the current item during each iteration of a loop when you write the for loop.

Happy coding!

Thanks again for your help! :slight_smile: