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 trialPete P
7,613 PointsWhy .pop() the last entry in the list of irises?
I'm just curious as to why there was an empty list at the end of the irises list that we had to pop off. Is there always an empty list as the last entry after reading a csv file?
Thanks for the help!
2 Answers
Ken Alger
Treehouse TeacherPete -
Great question. There isn't always an extra entry, but in this particular instance, there was. Although this course wasn't about, nor did we go into, data cleansing, you will often find cases in which doing some minor cleansing is needed.
Hope it helps and post back with any other questions.
Happy coding,
Ken
Stephen Hanlon
11,845 PointsIn this part of the code, if you print(irises)
you'll see the empty list at the end.
with open(input_file, 'r') as iris_data:
irises = list(csv.reader(iris_data))
print(irises)
Pete P
7,613 PointsPete P
7,613 PointsMany thanks!