lundi 6 août 2018

Understanding if statement within loop

I'm working through some examples from Treehouse via the python course, and I'm having a hard time understanding the code below.

As far as I can tell we are looping through "You got this!". However, I'm not sure what the if statement is actually doing; can someone explain this to me?

for letter in "You got this!":
    if letter in "oh":
        print(letter)

Aucun commentaire:

Enregistrer un commentaire