零基础入门学python 第19讲
题目:我的答案:
def judge():
sentence = input("请输入一句话:")
r = list(sentence)
r = r.reverse()
reverse_sen = "".join(r)
if reverse_sen == sentence:
print("是回文")
else:
print("不是回文")
judge()
用pycharm写出来r = r.reverse()一直返回None,不知道为什么
def judge():
sentence = input("请输入一句话:")
r = list(sentence)
r.reverse()
reverse_sen = "".join(r)
if reverse_sen == sentence:
print("是回文")
else:
print("不是回文")
judge()
reverse方法没有返回值 请问为什么r = r.reverse()会返回None呢,代码我明白了,我想问的是为什么我的写法会报错
页:
[1]