2 Answers
0
You could cast one string as a list,
invert it, cast back to string and comparenit with the other string
some_string = 'god'
some_other_str = 'dog'
inverted_list = list(some_string)[::-1]
inverted_string = "". join(inverted_list)
if some_other_str == inverted_str:
print("anagram")