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 trialZachary Parke
2,796 Pointsbreaks.py
I have my code attached. I went back to take a look at "Around and Around" to see if I could figure this out. Now I feel like I'm just typing too much out. I'm sad I couldn't figure this one out. Seemed like a simple concept.
def loopy(items):
while True:
new_item = input(">")
if new_item == "STOP":
break
items.append(new_item)
for item in items:
print(item)
items = []
2 Answers
Jeff Muday
Treehouse Moderator 28,720 PointsYou are very close! I indented the code that runs in the "while True" infinite loop. And add a call to your function with the empty list.
Have fun with Python, it's an amazing language!
def loopy(items):
while True:
new_item = input(">")
if new_item == "STOP":
break
items.append(new_item)
for item in items:
print(item)
items = []
loopy(items) # and here is where you "call" the function
Zachary Parke
2,796 PointsThanks Jeff. I realized that I actually needed much less code to answer this challenge, but I'm very glad that my code wasn't completely off base. I was just trying to do a little more.
Thanks again.