Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ##1
- class Student():
- def __init__(self, name, age, list_of_marks):
- self.name = name
- self.age = age
- # list_of_subjects = ["english", "science", "math"] ## not really required because it is redundant anyways but you can use it because it is in the question.
- self.marks = {
- "english": list_of_marks[0],
- "science": list_of_marks[1],
- "maths": list_of_marks[2],
- }
- b = Student("Bruce", 24, [92, 95, 99])
- a = Student("Alfred", 42, [29, 59, 88])
- # print(b.marks["maths"])
- # print(a.marks["maths"])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement