安全问答

安全问答是一个知识全球问答,包含丰富的问答知识

首页 常规 游戏 娱乐 科技 程序员

Python 代码实现趣味英语试题 2:判断对称字符串

  • 日期: 2026-11-11
  • 标签: 常规

def is_symmetric_string(s): left = 0 right = len(s) - 1

while left < right:
    if s[left] != s[right]:
        return 'No'
    left += 1
    right -= 1

return 'Yes'

string = input('请输入一个字符串:') result = is_symmetric_string(string) print(result)

Python 代码实现趣味英语试题 2:判断对称字符串

原文地址: https://www.cveoy.top/t/topic/fwuc 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录

  • 上一篇: Rethinking Regional Division: Incorporating Urban Development Level for Accurate Economic Analysis
  • 下一篇: Urban Development and Commercial Attraction: A Trend Analysis Based on China's Top Cities

© 2019 • 2025 - 安全问答 站长邮箱:wxgpt@qq.com    ICP备案/许可证号:豫ICP备2024104334号-2