How do I print elements of a list contained in a dictionary using a for loop
I have a dictionary:
FFA = {'House': ['0.511', '0.374', 10], 'Chair': ['0.704', '0.381', 10], 'Shoe': ['0.922', '0.465', 10], 'Bottle': ['0.764', '0.348', 10], 'Face': ['1.084', '0.373', 10]}
I want to print certain elements in a for loop:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
print "FFA", k, elem[0], elem[1], elem[2]
That's my output:
ROI Cope Mean Stddev Nsamples
FFA House 1.084 0.373 10
FFA Chair 1.084 0.373 10
FFA Shoe 1.084 0.373 10
FFA Bottle 1.084 0.373 10
FFA Face 1.084 0.373 10
However, my code is so wrong I can't find a way of iterating over all the keys in the dic so the right values are printed out.
I want my output to be:
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
FFA Face 1.084 0.373 10
python python-2.7 dictionary for-loop
add a comment |
I have a dictionary:
FFA = {'House': ['0.511', '0.374', 10], 'Chair': ['0.704', '0.381', 10], 'Shoe': ['0.922', '0.465', 10], 'Bottle': ['0.764', '0.348', 10], 'Face': ['1.084', '0.373', 10]}
I want to print certain elements in a for loop:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
print "FFA", k, elem[0], elem[1], elem[2]
That's my output:
ROI Cope Mean Stddev Nsamples
FFA House 1.084 0.373 10
FFA Chair 1.084 0.373 10
FFA Shoe 1.084 0.373 10
FFA Bottle 1.084 0.373 10
FFA Face 1.084 0.373 10
However, my code is so wrong I can't find a way of iterating over all the keys in the dic so the right values are printed out.
I want my output to be:
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
FFA Face 1.084 0.373 10
python python-2.7 dictionary for-loop
2
I'm really unclear on what your issue is or what you are trying to accomplish.
– busybear
Jan 2 at 18:24
All the values of Face were printed out as for the other keys (House, Chair, Shoe and Bottle)
– user10786574
Jan 2 at 18:26
your code is unclear. you are referring to elements indexed from a list calledelem
yet you have no reference to this list in your question. what doeselem
contain and how is it populated.
– Chris Doyle
Jan 2 at 18:58
Do not continue vandalising your own questions
– jonrsharpe
Jan 4 at 10:14
add a comment |
I have a dictionary:
FFA = {'House': ['0.511', '0.374', 10], 'Chair': ['0.704', '0.381', 10], 'Shoe': ['0.922', '0.465', 10], 'Bottle': ['0.764', '0.348', 10], 'Face': ['1.084', '0.373', 10]}
I want to print certain elements in a for loop:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
print "FFA", k, elem[0], elem[1], elem[2]
That's my output:
ROI Cope Mean Stddev Nsamples
FFA House 1.084 0.373 10
FFA Chair 1.084 0.373 10
FFA Shoe 1.084 0.373 10
FFA Bottle 1.084 0.373 10
FFA Face 1.084 0.373 10
However, my code is so wrong I can't find a way of iterating over all the keys in the dic so the right values are printed out.
I want my output to be:
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
FFA Face 1.084 0.373 10
python python-2.7 dictionary for-loop
I have a dictionary:
FFA = {'House': ['0.511', '0.374', 10], 'Chair': ['0.704', '0.381', 10], 'Shoe': ['0.922', '0.465', 10], 'Bottle': ['0.764', '0.348', 10], 'Face': ['1.084', '0.373', 10]}
I want to print certain elements in a for loop:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
print "FFA", k, elem[0], elem[1], elem[2]
That's my output:
ROI Cope Mean Stddev Nsamples
FFA House 1.084 0.373 10
FFA Chair 1.084 0.373 10
FFA Shoe 1.084 0.373 10
FFA Bottle 1.084 0.373 10
FFA Face 1.084 0.373 10
However, my code is so wrong I can't find a way of iterating over all the keys in the dic so the right values are printed out.
I want my output to be:
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
FFA Face 1.084 0.373 10
python python-2.7 dictionary for-loop
python python-2.7 dictionary for-loop
edited Jan 4 at 10:07
jonrsharpe
78.7k11110220
78.7k11110220
asked Jan 2 at 18:21
user10786574
2
I'm really unclear on what your issue is or what you are trying to accomplish.
– busybear
Jan 2 at 18:24
All the values of Face were printed out as for the other keys (House, Chair, Shoe and Bottle)
– user10786574
Jan 2 at 18:26
your code is unclear. you are referring to elements indexed from a list calledelem
yet you have no reference to this list in your question. what doeselem
contain and how is it populated.
– Chris Doyle
Jan 2 at 18:58
Do not continue vandalising your own questions
– jonrsharpe
Jan 4 at 10:14
add a comment |
2
I'm really unclear on what your issue is or what you are trying to accomplish.
– busybear
Jan 2 at 18:24
All the values of Face were printed out as for the other keys (House, Chair, Shoe and Bottle)
– user10786574
Jan 2 at 18:26
your code is unclear. you are referring to elements indexed from a list calledelem
yet you have no reference to this list in your question. what doeselem
contain and how is it populated.
– Chris Doyle
Jan 2 at 18:58
Do not continue vandalising your own questions
– jonrsharpe
Jan 4 at 10:14
2
2
I'm really unclear on what your issue is or what you are trying to accomplish.
– busybear
Jan 2 at 18:24
I'm really unclear on what your issue is or what you are trying to accomplish.
– busybear
Jan 2 at 18:24
All the values of Face were printed out as for the other keys (House, Chair, Shoe and Bottle)
– user10786574
Jan 2 at 18:26
All the values of Face were printed out as for the other keys (House, Chair, Shoe and Bottle)
– user10786574
Jan 2 at 18:26
your code is unclear. you are referring to elements indexed from a list called
elem
yet you have no reference to this list in your question. what does elem
contain and how is it populated.– Chris Doyle
Jan 2 at 18:58
your code is unclear. you are referring to elements indexed from a list called
elem
yet you have no reference to this list in your question. what does elem
contain and how is it populated.– Chris Doyle
Jan 2 at 18:58
Do not continue vandalising your own questions
– jonrsharpe
Jan 4 at 10:14
Do not continue vandalising your own questions
– jonrsharpe
Jan 4 at 10:14
add a comment |
3 Answers
3
active
oldest
votes
You were close:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
elem = FFA[k]
print "FFA", k, elem[0], elem[1], elem[2]
or directly:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
print "FFA", k, FFA[k][0], FFA[k][1], FFA[k][2]
or just addelem = FFA[k]
. Or use.items()
, obviously, but I think it is instructive to show them this way
– juanpa.arrivillaga
Jan 2 at 18:36
add a comment |
Use items()
to iterate over the keys and the values. Since you have multiple values, iterate over the values using the nested for loop over multiple values. For python 2.x it will be print "FFA", k, values,
print "ROI", "Cope", "Mean", "Stddev", "Nsamples" # Header
for k, v in FFA.items():
# print ("FFA", k, end=" ") # For python 3.x
print "FFA", k,
for values in v:
print values,
# print (values, end=" ") # For python 3.x
print # To get to print to the new line
# print () # For python 3.x
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
FFA Face 1.084 0.373 10
remember to end the connecting lines after the for loop finished
– GeeTransit
Jan 2 at 18:26
1
@GeeTransit: I realized it and edited it. Thanks :)
– Bazingaa
Jan 2 at 18:27
2
does end="" work with python 2.7 ... doubt it
– Patrick Artner
Jan 2 at 18:27
2
@Bazingaa Judging from the print statement in the asker's code, I'd say python 2 is accurate.
– glibdud
Jan 2 at 18:28
2
The syntax of theprint
instruction shows that OP uses Python 2
– Serge Ballesta
Jan 2 at 18:28
|
show 7 more comments
You already loop over the keys, now you simply need to loop over the elements of the values:
FFA = {'House': ['0.511', '0.374', 10],
'Chair': ['0.704', '0.381', 10],
'Shoe': ['0.922', '0.465', 10],
'Bottle': ['0.764', '0.348', 10],
'Face': ['1.084', '0.373', 10]}
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA: # loop over keys in dict
print "FFA", k, # , at end == no newline
for elem in FFA[k]: # loop over values in list of key
print elem, # , at end == no newline
print # now a newline
Output:
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
add a comment |
Your Answer
StackExchange.ifUsing("editor", function () {
StackExchange.using("externalEditor", function () {
StackExchange.using("snippets", function () {
StackExchange.snippets.init();
});
});
}, "code-snippets");
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "1"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54011277%2fhow-do-i-print-elements-of-a-list-contained-in-a-dictionary-using-a-for-loop%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
You were close:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
elem = FFA[k]
print "FFA", k, elem[0], elem[1], elem[2]
or directly:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
print "FFA", k, FFA[k][0], FFA[k][1], FFA[k][2]
or just addelem = FFA[k]
. Or use.items()
, obviously, but I think it is instructive to show them this way
– juanpa.arrivillaga
Jan 2 at 18:36
add a comment |
You were close:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
elem = FFA[k]
print "FFA", k, elem[0], elem[1], elem[2]
or directly:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
print "FFA", k, FFA[k][0], FFA[k][1], FFA[k][2]
or just addelem = FFA[k]
. Or use.items()
, obviously, but I think it is instructive to show them this way
– juanpa.arrivillaga
Jan 2 at 18:36
add a comment |
You were close:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
elem = FFA[k]
print "FFA", k, elem[0], elem[1], elem[2]
or directly:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
print "FFA", k, FFA[k][0], FFA[k][1], FFA[k][2]
You were close:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
elem = FFA[k]
print "FFA", k, elem[0], elem[1], elem[2]
or directly:
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA:
print "FFA", k, FFA[k][0], FFA[k][1], FFA[k][2]
answered Jan 2 at 18:27
Serge BallestaSerge Ballesta
81.2k961133
81.2k961133
or just addelem = FFA[k]
. Or use.items()
, obviously, but I think it is instructive to show them this way
– juanpa.arrivillaga
Jan 2 at 18:36
add a comment |
or just addelem = FFA[k]
. Or use.items()
, obviously, but I think it is instructive to show them this way
– juanpa.arrivillaga
Jan 2 at 18:36
or just add
elem = FFA[k]
. Or use .items()
, obviously, but I think it is instructive to show them this way– juanpa.arrivillaga
Jan 2 at 18:36
or just add
elem = FFA[k]
. Or use .items()
, obviously, but I think it is instructive to show them this way– juanpa.arrivillaga
Jan 2 at 18:36
add a comment |
Use items()
to iterate over the keys and the values. Since you have multiple values, iterate over the values using the nested for loop over multiple values. For python 2.x it will be print "FFA", k, values,
print "ROI", "Cope", "Mean", "Stddev", "Nsamples" # Header
for k, v in FFA.items():
# print ("FFA", k, end=" ") # For python 3.x
print "FFA", k,
for values in v:
print values,
# print (values, end=" ") # For python 3.x
print # To get to print to the new line
# print () # For python 3.x
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
FFA Face 1.084 0.373 10
remember to end the connecting lines after the for loop finished
– GeeTransit
Jan 2 at 18:26
1
@GeeTransit: I realized it and edited it. Thanks :)
– Bazingaa
Jan 2 at 18:27
2
does end="" work with python 2.7 ... doubt it
– Patrick Artner
Jan 2 at 18:27
2
@Bazingaa Judging from the print statement in the asker's code, I'd say python 2 is accurate.
– glibdud
Jan 2 at 18:28
2
The syntax of theprint
instruction shows that OP uses Python 2
– Serge Ballesta
Jan 2 at 18:28
|
show 7 more comments
Use items()
to iterate over the keys and the values. Since you have multiple values, iterate over the values using the nested for loop over multiple values. For python 2.x it will be print "FFA", k, values,
print "ROI", "Cope", "Mean", "Stddev", "Nsamples" # Header
for k, v in FFA.items():
# print ("FFA", k, end=" ") # For python 3.x
print "FFA", k,
for values in v:
print values,
# print (values, end=" ") # For python 3.x
print # To get to print to the new line
# print () # For python 3.x
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
FFA Face 1.084 0.373 10
remember to end the connecting lines after the for loop finished
– GeeTransit
Jan 2 at 18:26
1
@GeeTransit: I realized it and edited it. Thanks :)
– Bazingaa
Jan 2 at 18:27
2
does end="" work with python 2.7 ... doubt it
– Patrick Artner
Jan 2 at 18:27
2
@Bazingaa Judging from the print statement in the asker's code, I'd say python 2 is accurate.
– glibdud
Jan 2 at 18:28
2
The syntax of theprint
instruction shows that OP uses Python 2
– Serge Ballesta
Jan 2 at 18:28
|
show 7 more comments
Use items()
to iterate over the keys and the values. Since you have multiple values, iterate over the values using the nested for loop over multiple values. For python 2.x it will be print "FFA", k, values,
print "ROI", "Cope", "Mean", "Stddev", "Nsamples" # Header
for k, v in FFA.items():
# print ("FFA", k, end=" ") # For python 3.x
print "FFA", k,
for values in v:
print values,
# print (values, end=" ") # For python 3.x
print # To get to print to the new line
# print () # For python 3.x
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
FFA Face 1.084 0.373 10
Use items()
to iterate over the keys and the values. Since you have multiple values, iterate over the values using the nested for loop over multiple values. For python 2.x it will be print "FFA", k, values,
print "ROI", "Cope", "Mean", "Stddev", "Nsamples" # Header
for k, v in FFA.items():
# print ("FFA", k, end=" ") # For python 3.x
print "FFA", k,
for values in v:
print values,
# print (values, end=" ") # For python 3.x
print # To get to print to the new line
# print () # For python 3.x
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
FFA Face 1.084 0.373 10
edited Jan 2 at 18:41
answered Jan 2 at 18:24
BazingaaBazingaa
15.2k21330
15.2k21330
remember to end the connecting lines after the for loop finished
– GeeTransit
Jan 2 at 18:26
1
@GeeTransit: I realized it and edited it. Thanks :)
– Bazingaa
Jan 2 at 18:27
2
does end="" work with python 2.7 ... doubt it
– Patrick Artner
Jan 2 at 18:27
2
@Bazingaa Judging from the print statement in the asker's code, I'd say python 2 is accurate.
– glibdud
Jan 2 at 18:28
2
The syntax of theprint
instruction shows that OP uses Python 2
– Serge Ballesta
Jan 2 at 18:28
|
show 7 more comments
remember to end the connecting lines after the for loop finished
– GeeTransit
Jan 2 at 18:26
1
@GeeTransit: I realized it and edited it. Thanks :)
– Bazingaa
Jan 2 at 18:27
2
does end="" work with python 2.7 ... doubt it
– Patrick Artner
Jan 2 at 18:27
2
@Bazingaa Judging from the print statement in the asker's code, I'd say python 2 is accurate.
– glibdud
Jan 2 at 18:28
2
The syntax of theprint
instruction shows that OP uses Python 2
– Serge Ballesta
Jan 2 at 18:28
remember to end the connecting lines after the for loop finished
– GeeTransit
Jan 2 at 18:26
remember to end the connecting lines after the for loop finished
– GeeTransit
Jan 2 at 18:26
1
1
@GeeTransit: I realized it and edited it. Thanks :)
– Bazingaa
Jan 2 at 18:27
@GeeTransit: I realized it and edited it. Thanks :)
– Bazingaa
Jan 2 at 18:27
2
2
does end="" work with python 2.7 ... doubt it
– Patrick Artner
Jan 2 at 18:27
does end="" work with python 2.7 ... doubt it
– Patrick Artner
Jan 2 at 18:27
2
2
@Bazingaa Judging from the print statement in the asker's code, I'd say python 2 is accurate.
– glibdud
Jan 2 at 18:28
@Bazingaa Judging from the print statement in the asker's code, I'd say python 2 is accurate.
– glibdud
Jan 2 at 18:28
2
2
The syntax of the
print
instruction shows that OP uses Python 2– Serge Ballesta
Jan 2 at 18:28
The syntax of the
print
instruction shows that OP uses Python 2– Serge Ballesta
Jan 2 at 18:28
|
show 7 more comments
You already loop over the keys, now you simply need to loop over the elements of the values:
FFA = {'House': ['0.511', '0.374', 10],
'Chair': ['0.704', '0.381', 10],
'Shoe': ['0.922', '0.465', 10],
'Bottle': ['0.764', '0.348', 10],
'Face': ['1.084', '0.373', 10]}
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA: # loop over keys in dict
print "FFA", k, # , at end == no newline
for elem in FFA[k]: # loop over values in list of key
print elem, # , at end == no newline
print # now a newline
Output:
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
add a comment |
You already loop over the keys, now you simply need to loop over the elements of the values:
FFA = {'House': ['0.511', '0.374', 10],
'Chair': ['0.704', '0.381', 10],
'Shoe': ['0.922', '0.465', 10],
'Bottle': ['0.764', '0.348', 10],
'Face': ['1.084', '0.373', 10]}
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA: # loop over keys in dict
print "FFA", k, # , at end == no newline
for elem in FFA[k]: # loop over values in list of key
print elem, # , at end == no newline
print # now a newline
Output:
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
add a comment |
You already loop over the keys, now you simply need to loop over the elements of the values:
FFA = {'House': ['0.511', '0.374', 10],
'Chair': ['0.704', '0.381', 10],
'Shoe': ['0.922', '0.465', 10],
'Bottle': ['0.764', '0.348', 10],
'Face': ['1.084', '0.373', 10]}
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA: # loop over keys in dict
print "FFA", k, # , at end == no newline
for elem in FFA[k]: # loop over values in list of key
print elem, # , at end == no newline
print # now a newline
Output:
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
You already loop over the keys, now you simply need to loop over the elements of the values:
FFA = {'House': ['0.511', '0.374', 10],
'Chair': ['0.704', '0.381', 10],
'Shoe': ['0.922', '0.465', 10],
'Bottle': ['0.764', '0.348', 10],
'Face': ['1.084', '0.373', 10]}
print "ROI", "Cope", "Mean", "Stddev", "Nsamples"
for k in FFA: # loop over keys in dict
print "FFA", k, # , at end == no newline
for elem in FFA[k]: # loop over values in list of key
print elem, # , at end == no newline
print # now a newline
Output:
ROI Cope Mean Stddev Nsamples
FFA House 0.511 0.374 10
FFA Chair 0.704 0.381 10
FFA Shoe 0.922 0.465 10
FFA Bottle 0.764 0.348 10
answered Jan 2 at 18:28
Patrick ArtnerPatrick Artner
25.9k62544
25.9k62544
add a comment |
add a comment |
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f54011277%2fhow-do-i-print-elements-of-a-list-contained-in-a-dictionary-using-a-for-loop%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
2
I'm really unclear on what your issue is or what you are trying to accomplish.
– busybear
Jan 2 at 18:24
All the values of Face were printed out as for the other keys (House, Chair, Shoe and Bottle)
– user10786574
Jan 2 at 18:26
your code is unclear. you are referring to elements indexed from a list called
elem
yet you have no reference to this list in your question. what doeselem
contain and how is it populated.– Chris Doyle
Jan 2 at 18:58
Do not continue vandalising your own questions
– jonrsharpe
Jan 4 at 10:14