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 trialLevi Perlei
1,876 PointsHelp with break Pls.
def loopy(items): for i in items: print(i) if i == "STOP": break
I cant pass with this code, why?
def loopy(items):
for i in items:
print(i)
if i == "STOP":
break
4 Answers
Jennifer Nordell
Treehouse TeacherHi Levi! You're pretty close here so I'm going to give a couple of hints. I feel like this will be a better overall learning experience for you instead of just giving the answer.
- Currently, if I send in "STOP", your code will first print out "STOP" then check to see if it was "STOP"
- Your indentation is a bit off
- Check first to see if the item is "STOP"
- If the item is "STOP" break
- Otherwise print the item
Good luck, but let me know if you're still stuck!
Brian Jensen
Treehouse StaffThis Jennifer Nordell here is even more helpful than that one
Jennifer Nordell
Treehouse TeacherYou are certainly entitled to your opinion. However, I'd point out that the challenge you linked to had a different set of difficulties as they were failing on step 1... not step 2. I, much like yourself, am doing my best to help out fellow students.
Brian Jensen
Treehouse StaffJennifer Nordell Hehe I was completely just being silly since you have twice VERY eloquently answered this challenges questions tasks
Oh and to play with the emoticons more that you taught me lol.
Brian Jensen
Treehouse StaffJennifer Nordell I just want to make sure that you know that the answer I was referring to in the link I posted here was also from you. The joke I failed to make was that it was you vs you. I did not mean any offense at all, I absolutely LOVE the answers you gave here and there for task 1 and task 2. I hope to one day help other students in such a detailed and beautifully written way as you do. I have a lonnnggg way to go.
Jennifer Nordell
Treehouse TeacherHI! I got the joke No worries. Your help in the Community is appreciated!
Levi Perlei
1,876 PointsThanks for the answers! :)