Q:

How can I find which key exists in dict without if statements?

I've got a dictionary and know that only one of N keys exists in that dictionary. The task is to find and save the value of the existing key.
I wrote the following bruteforce code but I believe there should be a nice oneliner or something:
final_key = None
for key in ['aa', 'bbb', 'cccc', 'ddddd', 'e']:
   if key in dict:
      final_key = key
      break

A:

You can do it with a set operation:
set(dict).intersection(['aa', 'bbb', 'cccc', 'ddddd', 'e'])

