Write a statement in python to declare a dictionary D with 100 keys 0,1,…99 each
having values with 200
Answers
Answered by
1
D = dict(enumerate(range(0,99,+1),1))
Explanation:
The question is to write a statement in Python to declare a Dictionary D with 100 keys 0 to 99. There is no requirement to print or do any other operation. So I have given the simple statement to declare a dictionary with the required syntax below.
D = dict(enumerate(range(0,99,+1),1))
Syntax of Dictionary Comprehension is {key: value for (key, value) in iterable}. Iterable is any Python object in which you can loop over.
Similar questions