Hi,
I am trying to write a line of code that should return the names and their favourite colors. Somehow it won't work. What am i doing wrong? I don't get an error messgae just nothing happens when i press enter after the code.
Thanks in advance!
I am trying to write a line of code that should return the names and their favourite colors. Somehow it won't work. What am i doing wrong? I don't get an error messgae just nothing happens when i press enter after the code.
Thanks in advance!
>>> Colors = {"Sam": "Blauw", "Ali": "Rood", "Saar": "Geel"} >>> Colors {'Sam': 'Blauw', 'Ali': 'Rood', 'Saar': 'Geel'} >>> Colors.keys() dict_keys(['Sam', 'Ali', 'Saar']) >>> for Item in Colors.keys(): print("{0} houdt van de kleur {1}." .format(Item, Colors{Item})) SyntaxError: invalid syntax >>> for Item in Colors.keys(): print("{0} houdt van de kleur {1}." .format(Item, Colors[Item]))