鱼C论坛

 找回密码
 立即注册
查看: 4321|回复: 13

有谁能用逻辑清晰的方法解决这道题

[复制链接]
发表于 2023-8-9 11:53:22 | 显示全部楼层
yinda_peng 发表于 2023-8-9 11:25
呼叫人工@歌者文明清理员 #5

小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2023-8-9 12:35:32 | 显示全部楼层
  1. class Word(str):
  2.     def __init__(self, s):
  3.         if ' ' in s:
  4.             s = s.split(" ")[0]
  5.         str.__init__(self, s)
  6.     def __lt__(self, other):
  7.         return len(self)<len(other)
  8.     def __gt__(self, other):
  9.         return len(self)>len(other)
  10.     def __eq__(self):
  11.         return len(self)==len(other)
复制代码
小甲鱼最新课程 -> https://ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2025-11-6 04:17

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表