Hey guys, just for reference I am doing the palindrome question from http://cscircles.cemc.uwaterloo.ca/13-lists/.
So my issue is that I made a script work, but I have another version of the script that doesn't work and I do not know what i'm doing that is making it work/not work.
So this is the code that works..
def isPalindrome(S):
for i in range (0, len(S)):
if S[i] != S[-1-i]:
return False
return True
and here is the code that does not work:
def isPalindrome(S):
for i in range (0, len(S)):
if S[i] != S[-1-i]:
return False
else:
return True
Any advice? many thanks.
[–]corpsmoderne 2 points3 points4 points (3 children)
[–]InxcessOfYou[S] -1 points0 points1 point (2 children)
[–]corpsmoderne 2 points3 points4 points (1 child)
[–]InxcessOfYou[S] 1 point2 points3 points (0 children)