def checker(string):
collection=list(string)
print(collection)
while string.isalpha()==True:
copy_collection=collection
copy_collection.reverse()
print(copy_collection)
if copy_collection==collection:
print("The string is a palindrome")
else:
print("The string is not a palindrome")
break
name=input("Enter a string: ")
checker(name)
I wanted to know if the string input by the user is a palindrome. Most of the solution suggests using [::-1]. Is it possible to do without using that because our lecturer has not taught us that and told us to not go outside the course to write the program.
if copy_collection==collection: I think the problem is here because it will print out "the string is a palindrome" even if it is not.
Thanks in advance.