class student:
def __init__(self,name,sub,mark):
self.name=name
self.sub=sub
self.mark=mark
def on_kv_board(self):
if (self.mark>=450):
return True
else:`enter code here`
return False
students=[]
num_student=int(input("Enter the number of students appeared:"))
for entries in range(0,num_student):
name=input("Student name:")
sub=input("Subject in which "+name+" got the highest mark:")
mark=int(input("Total marks obtained/500:"))
if student(name,sub,mark).on_kv_board() is True:
a=(student(name,sub,mark))
students.append(a)
print(students)
每当我用两个输入来打印students []列表时,它就会给我一个输出[0x03784790的Student.student对象,0x037D61B0的Student.student对象]
相关分类