Skip to content

Dictionary Help #21455

Answered by mpboom
Lundo1 asked this question in General
Feb 9, 2021 · 2 comments
Discussion options

You must be logged in to vote

Hey @Lundo1 and welcome to the GitHub Community Forum! Yes, coding could definitely be a fun hobby and everyone can learn! Let me break down the code step-by-step for you.

# Below here, a dictionary is defined. Just like in real life, a
# dictionary in Python maps so-called "keys" (in real-life the words,
# but in this case some names) to "values" (in real-life the
# definitions, but in this case their favorite programming language).
favorite_languages = {
    'jen' : 'python',
    'sarah' : 'c',
    'edward' : 'ruby',
    'phil' : 'python’'
}

Here, we create a list that contains names of your friends:

friends = ['phil', 'sarah']

Here we make a for-loop. We loop through the keys, since th…

Replies: 2 comments

Comment options

You must be logged in to vote
0 replies
Answer selected
Comment options

You must be logged in to vote
0 replies
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants