Nov-19-2019, 05:36 AM
how can I randomly pick a key,value pair from a dictionary?
..and then assign it to a variable and use the variable to delete from the dictionary
..and use the key value pair captured in the variable to add to another dictionary
..and use the variable to print keys and values ?
a = (random.choice(list(Alldict)))
print(a)
The above statement gives me only the key but not the value?
..and then assign it to a variable and use the variable to delete from the dictionary
..and use the key value pair captured in the variable to add to another dictionary
..and use the variable to print keys and values ?
a = (random.choice(list(Alldict)))
print(a)
The above statement gives me only the key but not the value?