什么是回文诗:
有这样一类数,他们可以顺着和倒着念都有韵味。
经典的诗有
潮随暗浪雪山倾,远浦渔舟钓月明。
桥对寺门松径小,槛当泉眼石波清。
知识点:字符串的索引和序列
while True:
sentence = raw_input('input a sentence')
if sentence == 'q' or sentence == 'Q':
break
elif sentence == sentence[::-1]:
print 'This sentence is a palindrome'
else:
print 'This is a normal sentence'
输出如下: