Python: How to initialize a 10-entry Dictionary(hash)

#initialize hash directory

counts={i:0 for i in ‘0123456789’}

#We have now initialized a dictionary hash named counts with 10 entries:

0-10 with each entry having a value of 0.

#we display the entries of the counts dictionary by simply calling its name:

counts

#here is the output from my terminal

Leave a comment

Design a site like this with WordPress.com
Get started