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 trialAlfred Moha
8,205 PointsWrite a for loop that iterates over the provided list. The body of the for loop should print the c
where am ii getting wrong
rainbow = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
for element in list:
print(element)
3 Answers
Ken Stone
29,703 PointsIndent print so it's in the for loop and also the for line should be for element in rainbow
rainbow = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
for element in rainbow:
print(element)
Lynn Collins
10,080 PointsThe following code helped me pass: rainbow = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet']
for item in rainbow: print(item)
Alfred Moha
8,205 Pointsthanks guys it worked for me.. i appreciate