test_string = "XAT--12C-S" print(bool([i for i in ["XAT--12A-S", "XAT--12B-S"] if(i in test_string)])) print(test_string[len(test_string)-1])