NP97. 班级管理
描述
输入描述
输出描述
用一句话输出学生的姓名、学号、分数、提交作业的次数、每次作业的等级,可以参考输出样例。示例1
输入:
NiuNiu 12345 90 A B C
输出:
NiuNiu's student number is 12345, and his grade is 90. He submitted 3 assignments, each with a grade of A B C
Python 解法, 执行用时: 13ms, 内存消耗: 2944KB, 提交时间: 2022-07-22
class Student: def __init__(self,name,no,num,list): self.num = num self.name = name self.no = no self.list = list name = raw_input() no = raw_input() num = raw_input() s = raw_input() list = s.split() workNumber = len(list) d = Student(name, no, num, list) print "{}'s student number is {}, and his grade is {}. He submitted {} assignments, each with a grade of {}".format(d.name,d.no,d.num,workNumber,s,)
Python 解法, 执行用时: 13ms, 内存消耗: 3120KB, 提交时间: 2022-07-11
class Student: def __init__(self,name,no,num,list): self.num = num self.name = name self.no = no self.list = list name = raw_input() no = raw_input() num = raw_input() s = raw_input() list = s.split() workNumber = len(list) d = Student(name, no, num, list) print "{}'s student number is {}, and his grade is {}. He submitted {} assignments, each with a grade of {}".format(d.name,d.no,d.num,workNumber,s,)
Python 解法, 执行用时: 14ms, 内存消耗: 2948KB, 提交时间: 2022-06-11
class Student(object): def __init__(self, name, sid, score, rank): self.name = name self.id = sid self.score = score self.a = rank self.alen = len(rank.split(" ")) name = raw_input() sid = int(raw_input()) score = int(raw_input()) a = raw_input() d = Student(name, sid, score, a) print(d.name+"'s student number is "+str(d.id)+", and his grade is "+str(d.score)+". He submitted "+str(d.alen)+" assignments, each with a grade of "+d.a)
Python 3 解法, 执行用时: 30ms, 内存消耗: 4472KB, 提交时间: 2022-07-19
class Student: def __init__(self,name,number,grade,homework): self.name = name self.number = number self.grade = grade self.homework = homework stu = Student name =input() number=input() grade = input() homework =input() print(f"{name}'s student number is {number}, and his grade is {grade}. He submitted {len(homework.split(' '))} assignments, each with a grade of {homework}")
Python 3 解法, 执行用时: 30ms, 内存消耗: 4492KB, 提交时间: 2022-07-15
a = input() b = input() c = input() d = input() g = 0 x = d name = a + "'s student number is " + b + ', ' point = 'and his grade is ' + c + '. ' for i in x.replace(' ',''): g += 1 sor = 'He submitted '+ str(g) + ' assignments, each with a grade of ' + d print(name + point + sor)