Answered You can hire a professional tutor to get the answer.

QUESTION

I cant figure out how to structure my function. def run_sim(lanes, capacity, block_lanes, block_time, rnd_gen) : time = 0 curr_wait = 0 while...

I cant figure out how to structure my function. Please help!

def run_sim(lanes, capacity, block_lanes, block_time, rnd_gen) :

  time = 0

  curr_wait = 0

  while curr_wait > 0 : 

    curr_wait += 1

    time += 1

    arrive = lanes * rnd_gen.next_arrival()

    depart = capacity

    curr_wait = calc_waiting(arrive, depart, curr_wait)

    if time <= block_time:

      time += 1 

      curr_wait = calc_waiting(arrive, depart, curr_wait) 

      leave = capacity * (lanes - block_lanes)

    if time > block_time:

      curr_wait = calc_waiting(arrive, depart, curr_wait)

      time += 1

      curr_wait = curr_wait - capacity

      leave = lanes * capacity

  print(sim_line(time, arrive, leave, curr_wait))

Show more
LEARN MORE EFFECTIVELY AND GET BETTER GRADES!
Ask a Question