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 trialRIP' FINGALINS"""""""""
2,002 PointsHelp can someone help me with this?
I need help! please help me now horse lips
1 Answer
Jeff Muday
Treehouse Moderator 28,720 PointsHahahah "Horse Lips" that's pretty funny way to describe curly-braced dictionaries!
You should definitely practice using dictionaries-- they might seem confusing at first, but they are a very useful data representation and a way to bridge between JSON data formats so common with API results.
To access keys and values:
student = {'name': 'Craig', 'major': 'Computer Science', 'credits': 36}
for key, val in student.items():
print(key)
print(value)
To access just the keys:
student = {'name': 'Craig', 'major': 'Computer Science', 'credits': 36}
for key in student.keys():
print(key)
To access just the values:
student = {'name': 'Craig', 'major': 'Computer Science', 'credits': 36}
for value in student.values():
print(value)
Chris Freeman
Treehouse Moderator 68,441 PointsChris Freeman
Treehouse Moderator 68,441 PointsCan you be more specific on the help you need? Answers are among keys, values, items, True, False