Coding Tip: dict.fromkeys
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}