+ 1

Printing dictionary using for loops

I'm wanting to print the value first followed by the key using for loops. Currently in school started my CS class

28th Sep 2018, 8:16 PM
Joey Brickey
Joey Brickey - avatar
2 Answers
+ 1
dict = {1: "one", 2: "two"} for key in dict: print(dict[key], key)
28th Sep 2018, 9:58 PM
Kevin Dietrichstein
Kevin Dietrichstein - avatar
+ 1
Thanks! I just got around to it and it worked great.
29th Sep 2018, 4:42 PM
Joey Brickey
Joey Brickey - avatar