fromkeys() Function to create a new dictionary , Take each element in the first parameter as the key of the dictionary , The second parameter is the value corresponding to all keys of the dictionary .
print(dict.fromkeys(['b','c'],0))
print(dict.fromkeys(('b','c'),0))
print(dict.fromkeys(['b','c']))
print(dict.fromkeys([]))
dict1={
'a':2}
print(dict1.fromkeys(['b','c'],0))
print(dict1)
Output :
{
'b': 0, 'c': 0}
{
'b': 0, 'c': 0}
{
'b': None, 'c': None}
{
}
{
'b': 0, 'c': 0}
{
'a': 2}