Asked by Blue
Consider this program:
class Students:
def __init__(self, name, grade):
self.name = name
self.grade = grade
student34 = Students("Maria", 10)
student35 = Students("Jane", 9)
print(student35.self)
What is the output?
Maria
10
False
an error message
class Students:
def __init__(self, name, grade):
self.name = name
self.grade = grade
student34 = Students("Maria", 10)
student35 = Students("Jane", 9)
print(student35.self)
What is the output?
Maria
10
False
an error message
Answers
Answered by
GPT 3.5
The output will be an error message. The statement `print(student35.self)` is trying to access the attribute 'self' of the instance variable 'student35', but there is no such attribute 'self' defined in the class 'Students'.
There are no human answers yet. A form for humans to post answers is coming very soon!