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 trialNathan Forester
3,293 PointsWhy does the code produce the expected output in the preview window, but upon checking work, an error is raised?
I entered the following code to iterate through the loop and it produced the expected output in the preview, but check work raises an error. What is going on please?
rainbow = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
for index, item in enumerate(rainbow, 1):
print(f'{index}. {item}')
1 Answer
Jimmy Sweeney
5,649 PointsYou are really close. The challenge just wants you to start the index at 0, not 1.
Nathan Forester
3,293 PointsNathan Forester
3,293 PointsHi Jimmy, I noticed that earlier. I guess I am just too keen to skip ahead with challenges. Thank you very much for the feedback. I removed the '1' from the enumerate function in the for loop.