old_contents: class SpaceAge(object):
      def __init__(self, seconds):
          self.seconds = seconds
  
      @property
      def years(self):
          return self.seconds/31557600
  
      def on_earth(self):
          return round(self.years, 2)
  
      def on_mercury(self):
          return round(self.years/0.2408467, 2)
  
      def on_venus(self):
          return round(self.years/0.6151976, 2)
  
      def on_mars(self):
          return round(self.years/1.8808158, 2)
  
      def on_jupiter(self):
          return round(self.years/11.862615, 2)
  
      def on_saturn(self):
          return round(self.years/29.447498, 2)
  
      def on_uranus(self):
          return round(self.years/84.016846, 2)
  
      def on_neptune(self):
          return round(self.years/164.79132, 2)
  
new_contents: class SpaceAge(object):
      YEARS = {"on_earth": 1,
               "on_mercury": 0.2408467,
               "on_venus": 0.61519726,
               "on_mars": 1.8808158,
               "on_jupiter": 11.862615,
               "on_saturn": 29.447498,
               "on_uranus": 84.016846,
               "on_neptune": 164.79132}
  
      def __init__(self, seconds):
          self.seconds = seconds
  
      @property
      def years(self):
          return self.seconds/31557600
  
      def __getattr__(self, on_planet):
          if on_planet in SpaceAge.YEARS:
              return lambda: round(self.years/SpaceAge.YEARS[on_planet], 2)
          else:
               raise AttributeError
  
subject: Implement __getattr__ to reduce code