I have 2 dictionaries in Python the user is asked to press a key to show a random key from the 2 dictionaries How can I do that?
Thank you
I have 2 dictionaries in Python the user is asked to press a key to show a random key from the 2 dictionaries How can I do that?
Thank you
You can use random.choice:
>>> import random
>>> random.choice([*dict1.keys(), *dict2.keys()])