I'm trying to find Palindrome so I copied the list to another variable but when I use reverse
function, both variables gets reversed. why is this happening?
I can use a loop and append from reverse order one by one, but I really want to know why reverse
function works this way.
arr = list(input())
ar = arr
ar.reverse()
print(arr, ar)
print("YES" if arr == ar else "NO"
I expect to find palindrome.