Cartesian Product of Dictionary Keys and Values Python
问题 I have two lists with data: COURSES = [C1, C2, C3] ROOMS = [R1, R2, R3] and I already created a list of tuples containing their cartesian product: L_CR = list(itertools.product(COURSES, ROOMS)) #print(L_CR): [('C1', 'R1'), ('C1', 'R2'), ('C1', 'R3'), ('C2', 'R1')..... Now I have created two dictionaries storing integer values about the amount of people attending a course and the maximum amount of people fitting into a room: dic_courses = {'C1': 10, 'C2': 5, 'C3': 20} dic_rooms = {'R1': 5, 'R2