There is a function dict.fromkeys I haven’t paid much attention to, but it can be very useful in many cases.
>>> all_students = ('Alex', 'Mike', 'Nick', 'John')
>>> dict.fromkeys(all_students, 0)
{'Alex': 0, 'Mike': 0, 'Nick': 0, 'John': 0}
Created at: 2017/12/28 15:59; Updated at: 2017/12/31 06:52