old_contents: from random import *
  
  def durring_train_station_pop(station, train, escalator):
      """
      calculate the population of the platform with train in station by looping
      through a second by second time step and calculate the platform population
      for each second.
      """
      # Generate a random number to set the size of the train.
      dice_roll = random()
      # The number of cars the train has.
      if  dice_roll < 0.30:
          train.cars(8)
  
      elif dice_roll > 0.30 < 0.60:
          train.cars(10)
  
      else:
          train.cars(12)
      # The number of people on the train.
      train.pop = int(dice_roll * train.car_capacity * train.cars))
      # Train max capacity
      train.cap = int(train.car_capacity * train.cars))
      """
      The number of people that want to get off the train.
      There is a new random number here so that the percentage of people leaving
      the train does not depend on the population
      """
      Leaving_train = train_pop * random()
          # People exit the train,  but first we need to calculate the train boarding,
          # and exiting rate.
          if (Station.capacity % Station_1.pop) < train.board_rate * train.cars:
              train.board_rate = station.capacity // (station.pop * train.cars)
          else:
              train.board_rate = escalator.rate
  
          population = station.pop +
                          # People getting off the train.
                          train.board_rate -
                          # People leave by escalator.
                          (station.escalators_exitying * escalator.rate) +
                          # People enter by escalator.
                          (station.escalators_entering * escalator.rate)
          return population
  
new_contents: """
  This module allows one second of time to pass with a train in the station.
  It uses the rates of people leaving and enering the station from escalators and
  train to calculate the total population of the station every second.
  """
  
  def train_unloading_station_pop(station, train, escalator):
      """
      calculate the population of the platform while people are disembarking
      from the train. Each run reprisents the passing of one second in time.
      """
      """
      People exit the train, but first we need to calculate the train boarding,
      and exiting rate. if there are fewer spaces on the platform than the maximum
      boarding rate of the trains, then the rate at which people can exit the train
      in one second is equal to the number of empty spaces on the platform.
      """
  
      if (station.capacity % station.pop) < train.board_rate * train.cars:
          exit_train_rate = (station.capacity % station.pop)
      else:
          exit_train_rate = train.board_rate
  
      station.travelers_arriving = station.travelers_arriving + exit_train_rate
      station.travelers_departing = station.travelers_departing + (station.escalators_entering * escalator.rate)
  
  def train_boarding_station_pop(station, train, escalator):
      """
      calculate the population of the station while people are boarding the train.
      each run reprisents the passing of one second in time.
      """
      train.pop = train.pop + train.board_rate
      station.travelers_departing = station.travelers_departing - train.board_rate + (station.escalators_entering * escalator.rate)
      station.travelers_arriving = station.travelers_arriving - (station.escalators_exiting * escalator.rate)
  
subject: Simplify function to calculate the station population with a train