题解 | #班级管理#
班级管理
https://www.nowcoder.com/practice/e5539db11767449ab2fb68ed3c2446d0
class Student: def __init__(self,name,sno,score,grade) -> None: self.name = name self.sno=sno self.score=score self.grade=grade def __str__(self) -> str: return f"{self.name}'s student number is {self.sno}, and his grade is {self.score}. He submitted {len(self.grade)} assignments, each with a grade of {self.get_grade()}" def get_grade(self): return str(self.grade).replace('[','').replace(']','').replace(',',' ').replace("'",'').replace(" ",' ') name=input() sno=input() score=input() grade=input().split(' ') stu = Student(name,sno,score,grade) print(str(stu))