Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialVictor Padilla
566 PointsWhy is the output "o o h"?
for letter in "You got this!":
if letter in "oh":
print(letter)
I don't seem to understand why the output is "o o h"? What happened to the "you got this"? And where did the extra "o" come from?
Thanks
Victor Padilla
566 Pointsahhh ok ok , I understand now 👌🏽 thank you !
David Garcia
Python Development Techdegree Graduate 11,254 PointsDavid Garcia
Python Development Techdegree Graduate 11,254 Pointsthink about it like this: for every letter thats in 'you got this' and if the letter is in 'oh': then print out the letter
the if statement is checking the letters within the sentence and seeing if the letter is in the word 'oh' therefore it is printing an extra 'o' when looped. hopefully that makes it simpler its a tad bit confusing