Try it on paper first. A hint, the key idea and the worked solution are here when you need them.
For capitals = {"India": "New Delhi", "France": "Paris", "Japan": "Tokyo"}, find capitals["Japan"], len(capitals) and "Brazil" in capitals.
Look up by key. len counts the pairs. in asks about the keys.
Have you tried it?
Work it out on paper first. It is fine to get stuck or make a mistake: that is how we learn. When you are ready, compare your working with the solution.
capitals["Japan"] looks up the key: Tokyo.len(capitals) counts the pairs: 3."Brazil" in capitals asks about the keys. Brazil is not a key: False.Log in to join the discussion.
Loading…