+ 1
Write a python program that uses class to store exam number and marks of four subject.Yae list to store the marksof foursubject
3 odpowiedzi
+ 3
There some issues, see comments in code:
class student:
exam_no=int(input("Enter marks"));
marks=[]
for i in range(exam_no): # should not be hardcoded, use exam_no instead
n=int(input("enter marks")) # missing indentation
marks.append(n) # write "marks" not "Marks" # missing indentation
s=student()
print("\nexam no is:",s.exam_no)
print("\n4subject marks:",s.marks)
+ 3
Legends Feelings, when you mention an error, please tell us in which code the error occurs, and please also show us the error message. You should also show us your input values.
Thanks!
0
class Report :
def __init__(self, subject, marks):
self.subject = subject
self.marks = marks
maths = Report("Maths", 98)
science = Report ("Science", 87)