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 trial

Python Python Basics (2015) Shopping List App Break

I have been through this course twice and I get to a simple (should be simple) and get stuck I do not know how to ask a

good question or even know where to look to understand what the "Bummer!" is wrong

def loopy(items):
  for item in items:
    print(item)
    if item == "STOP":
      break

How can one learn this stuff?

[MOD: added ```python markdown formatting -cf]

1 Answer

Hi barrysw,

It looks like you understand the concept very well; the only issue with your code is that this Challenge wants you to break without printing STOP, while your code prints STOP then breaks.

def loopy(items): 
  for item in items:
    if item == "STOP": 
      break
    else:
      print(item) 

Hope that helps!

Thanks for the attempted help, I do appreciate it

I tried def loopy(items): for item in items: if item == "STOP" break else: print(item)

however when all I can get from Treehouse is " Bummer! Try again! " I am completely and totally lost and very frustrated! I have been through this two or thee times and must keep missing something simple therefore I mmust conclude that this method of learning is NOT for me.

I believe I am DONE with treehouse, seems to be a waste of time......

If that code isn't working for you, it probably is a spacing problem - too few or too many spaces moving an item out of its intended scope.

Sorry that you're having a rough time right now. Learning to code is a pretty big hurdle when it's all new, so don't feel bad if you get frustrated. If you're still planning on continuing to learn to code, but need a break or want to quit Treehouse, you might want to check into local meetup groups for Python, or picking up a book on the subject - it makes sense to be taught or teach yourself through whatever learning style most suits you.

Good luck on your learning!