Problem scenario
You want to write a palindrome tester function in Python without the :: operator in the code (that reverses the order of the list). What do you do?
Solution
def palindrome_tester(s):
s = s.lower()
x = len(s) // 2
for i in range(x):
if s[i] == s[-(i+1)]:
pass
else:
return False
return True
var_string = "mmnMM"
if (palindrome_tester(var_string)):
print(var_string + " is a palindrome!")
else:
print(var_string + " is NOT a palindrome!")