题解 | #修改属性1#

修改属性1

https://www.nowcoder.com/practice/c5ab441e5e8f4ec7bf36ba51a3141340

class Employee:
    def __init__(self):
        self.name = str(input())
        self.salary = int(input())
        self.age = int(input())
    def printclass(self):
        try:
            print('Error! No age')  
            print(f"{self.name}'salary is {self.salary}, and his age is {self.age}")
        except:
             print('Error! No age')      
i = Employee()
i.printclass()

全部评论
你都这样了还try什么(笑死)
点赞 回复 分享
发布于 2024-01-30 19:03 湖南
亏贼这代码写的
点赞 回复 分享
发布于 2023-05-30 16:50 辽宁
你这个写的明显不符合题意
点赞 回复 分享
发布于 2022-12-06 22:34 上海

相关推荐

不愿透露姓名的神秘牛友
昨天 11:29
点赞 评论 收藏
分享
06-19 12:33
安徽大学 Java
点赞 评论 收藏
分享
评论
3
收藏
分享

创作者周榜

更多
牛客网
牛客网在线编程
牛客网题解
牛客企业服务