human
I am working on the file "Sessions/Session03/Day2/OOP_solns.ipynb".
The first task is:
Problem 2f
Based on your knowledge of how galaxies evolve, do these results make sense?  Discuss with your coding partner if so/not, and ways in which you might tweak it to work better.
Possible Answers: For the most part, yes.  The galaxy consumes its cold gas and creates stars, and when it runs out of gas, it shuts off star formation for a time.  But after time, it accretes enough cold gas to allow it to form stars again, so it's in sort of loop.  But it's not really realistic because it needs to interact with its environment and other galaxies through galaxy mergers, gas accretion, gas stripping, etc.
Problem 3) Make a galaxy class that can interact with other galaxies (challenging!)
Most galaxies do not evolve in isolation, so let's make a galaxy class that enables galaxies to actually interact with each other.  We can re-use much of the code from our previous examples through inheritance!  Yeah!
Problem 3a
Let us create a new subclass of EvolveGalaxy, so that it inherits most of the traits of our previous work.  But we will add some new features including position and velocity values in the x-y plane, so that our galaxy can actually move over time.
Create a new class MovingGalaxy that is a subclass of EvolveGalaxy.  Make a new __init__ method with all of the arguments from it's parent class EvolveGalaxy, but add the additional arguments of x_position, y_position, x_velocity, y_velocity, and id_num.  
Note: all arguments must come before any keyword arguments, so the age kwarg has to come at the very end.
Also, make a new __repr__ method for this class that just includes it's idnum, x_position, and y_position.
To assure your code works, create an instance of a MovingGalaxy, and print it out.
Can you write Python program for it?
assistant
#Here is Python program to print it out.

class MovingGalaxy(EvolvingGalaxy):
    """
    Galaxy class that can evolve and move in the x,y plane
    """
    def __init__(self, total_mass, cold_gas_mass, stellar_mass, x_position, y_position, x_velocity, y_velocity, idnum, age=0):
        
        # Replace self with super to activate the superclass's methods
        super().__init__(total_mass, cold_gas_mass, stellar_mass)
        
        self.x_position = x_position
        self.y_position = y_position
        self.x_velocity = x_velocity
        self.y_velocity = y_velocity
        self.idnum = idnum
        
    def __repr__(self):
        return "Galaxy %i (x = %.0f; y = %.0f)" % (self.idnum, self.x_position, self.y_position)

milky_way = MovingGalaxy(1e12, 1e8, 1e10, 0, 0, 0, 0, 0)
print(milky_way)