city_block = 1000 local_speed = 25 major_speed = 35 normal_freeway = 55 congest_freeway = 20 red_prob = .01 Avg_redlight = 2 left_on_green = 6 left_green_arrow = 4 cars_left_peak = 12 cars_left_off_peak = 4 freeway_normal = [0]*9 freeway_congest = [0]*9 local = [0]*10 freeway_normal[0]= ((2*city_block)/5280)/local_speed*60 freeway_normal[1]= 0.5 freeway_normal[2]= ((2*city_block)/5280)/local_speed*60 freeway_normal[3]= (2.5/normal_freeway)*60 freeway_normal[4]= ((cars_left_peak/left_on_green)-1)*left_green_arrow freeway_normal[5]= ((1*city_block)/5280)/local_speed*60 freeway_normal[6]= red_prob*Avg_redlight freeway_normal[7]=((2*city_block)/5280)/local_speed*60 freeway_normal[8]= 0 freeway_congest[0]= ((2*city_block)/5280)/local_speed*60 freeway_congest[1]= 0.5 freeway_congest[2]= ((2*city_block)/5280)/local_speed*60 freeway_congest[3]= (2.5/congest_freeway)*60 freeway_congest[4]= ((cars_left_peak/left_on_green)-1)*left_green_arrow freeway_congest[5]= ((1*city_block)/5280)/local_speed*60 freeway_congest[6]= red_prob*Avg_redlight freeway_congest[7]=((2*city_block)/5280)/local_speed*60 freeway_congest[8]= 0 local[0] = ((2*city_block)/5280)/local_speed*60 local[1] = 0.5 local[2] = ((2*city_block)/5280)/local_speed*60 local[3] = (1.75/major_speed)*60 local[4] = 5*red_prob*Avg_redlight local[5] = ((cars_left_peak/left_on_green)-1)*left_green_arrow local[6] = ((1*city_block)/5280)/local_speed*60 local[7] = red_prob*Avg_redlight local[8] = ((2*city_block)/5280)/local_speed*60 fnormal = sum(freeway_normal) fcongest = sum(freeway_congest) flocal = sum(local) print '\n Freeway-Reg Freeway-Congest Local ' print '%8.2f'%fnormal + '%18.2f'%fcongest + '%15.2f'%flocal print('\n')