Q:

dict.fromkeys in python

{2, 4, 6, 8}
0
# Python program to demonstrate working 
# of map. 
  
# Return double of n 
def addition(n): 
    return n + n 
  
# We double all numbers using map() 
numbers = (1, 2, 3, 4) 
result = map(addition, numbers) 
print(list(result)) 
0
map(fun, iter)
0

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

thisdict = dict.fromkeys(x)


    print(thisdict)
#values are all None
   
0
for fruit, color in test.items():
    # do stuff
0

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

thisdict = dict.fromkeys(x, y)

    
print(thisdict)
   
0
Returns a list of the results after applying the given function  
to each item of a given iterable (list, tuple etc.) 
0

New to Communities?

Join the community