Answers for "fromkeys() in python"

1

fromkeys() in python

x = ('key1', 'key2', 'key3')
y = 0

thisdict = dict.fromkeys(x, y)

    
print(thisdict)

//Output:{'key1': 0, 'key2': 0, 'key3': 0}
Posted by: Guest on May-21-2021

Browse Popular Code Answers by Language