rescat2idx= [OrderedDict([('EAF', [1]),
('AOD', [2]),
('LF', [3]),
('CC1', [4]),
('CC2', [5]),
('H_A_S1', range(6, 30)),
('H_A_S2', range(30, 54)),
('H_B_S2', range(54, 78)),
('H_A_S3', range(78, 102)),
('H_B_S3', range(102, 126)),
('H_A_S4', range(126, 150)),
('H_B_S4', range(150, 174)),
('EN', [174])]),174]
trans_time = {'TR_S1': 10, 'TR_S2': 4, 'TR_S3': 10}
trans_time_max = {'TR_S1': 240, 'TR_S2': 240, 'TR_S3': 120}
for res_cat, resources in rescat2idx.items():
if 'H_B_' not in res_cat:
continue
max_wait_time = time_trans_max['TR_S%d' % **(int(res_cat[-1])** - 1)]
Note: What will be the output of max_wait_time? Will it work? I am new to python and I found that there is not integer elements in res_cat so how does max_wait_time works?
There are few issues in the code snippet, Which are
rescat2idxis a list, you need to iterate throughrescat2idx[0]f"TR_S{int(res_cat[-1]) - 1}"