题目详情
单选题 关于以下类的定义与使用,哪项说法正确?( )class MyClass: def __init__(self, x): self.x = x def __str__(self): return f"value: {self.x}"
A. 输出为 <__main__.MyClass object at ...>
B. 报错,因为 __str__ 应该返回int
C. 输出为 value: 5
D. = MyClass(5)print(a)A. 输出为 5

学科:默认课程
时间:2025-06-03 10:42:59
相关题目
相关作业
