
用python编写代码,判断用户输入的字符串是否是回文。
用python编写代码,判断用户输入的字符串是否是回文。 s=input("请输入字符串:") b=int(len(s)) flag=True for i in range(b): if s[i]!=s[b-i-1]: flag=False if flag: print("%s是回文串"%s) else: print("%s不是回文串"%s)
调试结果
👁️ 阅读量:0
© 版权声明:本文《用python编写代码,判断用户输入的字符串是否是回文。》内容均为本站精心整理或网友自愿分享,如需转载请注明原文出处:https://www.zastudy.cn/wen/1686864958a359675.html。