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 trial

Python Challenge

For in

If it was only one dictionary inside the list data, could I do this way? I mean, I need the "for in" bacause there is more than 1 dictionary or bacause the dictionary is inside of the list?

data = { "email": "we@afi.co", "name": "Warren Bates", "date_joined": "4/20/2048", "admin": "False", "id": "36" }

data['email'] = 'we@afi.co'


data['first_name'] = 'Warren Bates'.split(" ")[0]

data['last_name'] = 'Warren Bates'.split(" ")[1]

data['date_joined'] = '4/20/2048'

if data["admin"] == 'False': data["admin"] = False else: data['admin'] = True

data["id"] = int(36)


1 Answer

Steven Parker
Steven Parker
229,582 Points

When posting code, always use Markdown formatting to preserve the code's appearance, particularly the indentation which is crucial in Python. You might want to take a look at this video about Posting a Question.

But the loop is used for processing a list of multiple items, the kind of items doesn't matter. If you know the data will be only one item, you wouldn't need a list; but in this exercise, the function needs to process a list.