Jun-11-2019, 03:53 PM
hey this question isn't included in my homework but python is a part of my class so i hope it falls under this context but:
on my laptop i use pthon version 3 and ive been doing extra exercises on the topic and ive come across a problem that i dont quite understand and that involves reversing a string as a list to see if its writen the same backwards, this is what i came up with:
westbob
on my laptop i use pthon version 3 and ive been doing extra exercises on the topic and ive come across a problem that i dont quite understand and that involves reversing a string as a list to see if its writen the same backwards, this is what i came up with:
def palindrome(): a=[input("palindrome? : ")) print(a[::-1]) #just to see if a[::-1] actually reverses "a" (for some reason it doesn't) if a == a[::-1]: print("yes") else: print("no")any solutions to why [::-1] doesn't work, im not really looking for other ways to reverse a string just why it doesnt work this way... thanks in advance ^^
westbob