how to create a dictionary using the
dict() function? give an example.
Answers
Answered by
0
If you want to create a dictionary using dict() function in Python, (say)
details = {
'name' : 'Kalyan',
'born' : 2004,
'age' : 16
}
You can do that by :
details = dict(name="Kalyan", born=2004, age=16)
You can print a particular value of the dictionary by :
print(details['name'])
Hope this helps...
By the way, the details used in the question are mine... Ignore them... You can use your own details...
Have a great day...
sandhayakumari094:
python
Similar questions
Physics,
1 month ago
Chemistry,
1 month ago
Science,
3 months ago
CBSE BOARD XII,
3 months ago
India Languages,
9 months ago
Math,
9 months ago