for var in [a, b, c]: if not isinstance(var, int) : raise TypeError('Please make sure all inputs are integers') # - or - try: print(geeky_list[indices[i]]) except TypeError: print("TypeError: Check list of indices")