Implement a class Season that represents a season during a specified year. For purposes of this problem, assume that the seasons in each year are, in order, 'Winter', 'Spring', 'Summer', 'Autumn' . __init__, __repr__ A Season object is created by calling the constructor and supplying two optional arguments: 1. season, defaults to 'Winter' 2. calendar year, an int , defaults to 2023 For the __repr__ , see the usage below: The next and prev methods modify a Season object by changing it to the next season or previous season in sequence, respectively. Note that the seasons can "roll over" or "roll back" and that this may change the year by +/-1. 1. During each year, the seasons occur in this sequence: 'Winter', 'Spring', 'Summer', 'Autumn' 2. next - change to next season, if the current season is Autumn then year will increase by 1 3. prev - change to previous season, if Winter then year will decrease by 1 Implement the == operator ( __eq__ method) to compare two Season objects. Two seasons are equal if and only if they are the same season during the same year
Implement a class Season that represents a season during a specified year. For purposes of this
problem, assume that the seasons in each year are, in order, 'Winter', 'Spring', 'Summer', 'Autumn' .
__init__, __repr__
A Season object is created by calling the constructor and supplying two optional arguments:
1. season, defaults to 'Winter'
2. calendar year, an int , defaults to 2023
For the __repr__ , see the usage below:
The next and prev methods modify a Season object by changing it to the next season or previous
season in sequence, respectively. Note that the seasons can "roll over" or "roll back" and that this may
change the year by +/-1.
1. During each year, the seasons occur in this sequence: 'Winter', 'Spring', 'Summer',
'Autumn'
2. next - change to next season, if the current season is Autumn then year will increase by 1
3. prev - change to previous season, if Winter then year will decrease by 1
Implement the == operator ( __eq__ method) to compare two Season objects. Two seasons are
equal if and only if they are the same season during the same year
Step by step
Solved in 4 steps with 2 images