I understand that this is the easiest and most simplest way to check:
if val == val[::-1]:
print "yes"
else:
print "no"
but just for practice, I wanted to test it with nested for loops (using the reversed()
function -- I spent hours but couldn't quite figure where to continue
and break
to get it right:
for i in val:
for j in reversed(val):
if i == j:
break
break