I want to loop trough this dictionary in Python, and print key and the value, I’m a newbie in Python and the examples found on the internet doesn’t work or print errors.
So how could I loop the below table properly and display key/value?
letters = {
"m":1, "n":1, "r":1, "M":1, "N":1, "R":1, "l":1, "L":1, "1":1,
"3":1, "6":1, "7":1, "8":1, "0":1,
}
You can either use items(), e.g.:
or since it’s a dictionary, iterate over the keys, e.g.: