Python Challenge — Day 24
Aug 3, 2023
Source: https://twitter.com/clcoding/status/1686823934086299648?s=20
Level: beginner
Question
What is the output of this code, and why?
Answer
C : {'A': 65, 'B': 66, 'C': 67}
Explanation
This program is about defining a new dictionary called d
using dict
syntax. More or less it same as the case on Day 22 about key
and corresponding value
.
So, in d
dictionary will have key
and corresponding value
as follow (left is the key
and corresponding value
on the right).
A:65
B: 66
C:67
If we use alternative syntax then the first row will be d = {'A':65, 'B':66, 'C':67}
.