Closed wtbsw closed 5 years ago
What version of Python are you using? The corresponding example code checked into this repository works as expected in Python 2 and 3 for me. Maybe you can attach a gist that reproduces this? Please reopen if you can. Thanks.
class Grade(object): def init(self): self._value = 0
first_exam = Exam() first_exam.writing_grade = 82 first_exam.science_grade = 99 print('Writing', first_exam.writing_grade) print('Science', first_exam.science_grade)
results
Writing 82
Science 99
second_exam = Exam() second_exam.writing_grade = 75 print('Second', second_exam.writing_grade, 'is right') print('First', first_exam.writing_grade, 'is wrong')
result
Second 75 is right
First 82 is wrong
The result is right when the code run , compared with book' result where
Second 75 is right
First 75 is wrong
Glad to discuss with you. Thank you.