Jul-19-2018, 11:48 PM
(This post was last modified: Jul-19-2018, 11:48 PM by gontajones.)
Please, use the same thread for same issues.
Check this implementation:
Check this implementation:
x = {"F": "Fluorine", "Cl": "Chlorine"} y = {"O": "Oxygen"} def hal(target_dict, key): try: # This will raise KeyError if not found print(target_dict[key]) except KeyError: print(f'{key}: KeyError') def acc(target_dict, key): try: # This will raise KeyError if not found print(target_dict[key]) except KeyError: print(f'{key}: KeyError') def is_halogen_bond(halogen, acceptor): hal(x, halogen) acc(y, acceptor) user_key1 = input('Enter key 1: ') user_key2 = input('Enter key 2: ') while user_key1 != 'exit' and user_key2 != 'exit': is_halogen_bond(user_key1, user_key2) user_key1 = input('Enter key 1: ') user_key2 = input('Enter key 2: ')