Hi I am trying to make a function that checks for Palindromes and I thought I could easily use the list.reverse()
function but something strange is happening and I was wondering why. Here is my code:
x = list('hey')
x
['h', 'e', 'y']
y = x
y
['h', 'e', 'y']
y.reverse()
y
['y', 'e', 'h']
x
['y', 'e', 'h']
My question is why is it that when I reverse the list y it also reverses the list x?