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 trialChristian Geib
826 PointsStuck at this question - error message, not supposed to use while loop as well?
Here's my stab at it:
def loopy(items): # Code goes here items = [] while True: new_items = input(" ")
for new_items:
print(items)
Am not supposed to involve a while loop?
def loopy(items):
# Code goes here
items = []
while True:
new_items = input(" ")
for new_items:
print(items)
1 Answer
Chris Freeman
Treehouse Moderator 68,441 PointsThese and later challenges are tested using an automated checker that will call the function with various values assigned to items
. The is no need to use a while
loop or use the input()
function. Your code is also resetting the input value back to an empty list. Removing these statements leaves you with:
def loopy(items):
# Code goes here
#items = []
#while True:
# new_items = input(" ")
for new_items:
print(items)
This is closer. Now the for
loop syntax is incorrect.
# loop over the items
for item in items:
print(item)
Post back if you need more help. Good Luck!!
Christian Geib
826 PointsChristian Geib
826 PointsHi there, Chris, thanks for your response, if I cut out the while loop and the input, I think I would just use:
but that still gives me a generic 'Bummer, Try again' error message.
Chris Freeman
Treehouse Moderator 68,441 PointsChris Freeman
Treehouse Moderator 68,441 PointsThe print statement is missing the parens.