Input data:
rules = (
("1|1": "A"),
("2|1": "B"),
("3|1": "C"),
("2|2": "X")
)
pattern = [[1,2,3], [7,8]]
I need a function to do this job for the below result:
list1 = [[1,3,4], [7,9]] # result: B
list2 = [[1,2,3], [7,9]] # result: C
list3 = [[0,5,4], [8,5]] # result: None
list4 = [[1,6,2], [7,8]] # result: X
list5 = [[1,6,2,5], [7,8]] # result: Error
A bit of functional Python:
Works the same for the rest of lists. Error handling is the exercice for you:)