I am trying to compare two strings
in python 3.6
and if they are not equal then print a message and exit. My current code is:
location = 'United States of America'
if location.lower() != 'united states of america' or location.lower() != 'usa':
print('Location was different = {}'.format(location.lower()))
sys.exit()
else:
#do something
But the above code is not able to match the two strings and even though they are equal, it enters the loop and prints that they are different. I know its some silly mistake that I am making but unable to figure it out.
'United States of America'.lower() != 'usa'
– Shinra tensei Feb 22 '18 at 9:42