Chapter/Index: Introduction | A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | Appendix
Check if two lists are identical. Code: ============================================ Check if two lists are identical. Code: ============================================ Check if two lists are identical. Code: ============================================ Check if two lists are identical. The map() function is used to apply the lambda function lambda m, k: m == k to pair-wise elements of ListA and ListB, returning a list of Boolean values indicating whether each pair of elements is equal. The reduce() function from the functools module is then used to reduce the list of Boolean values to a single Boolean value indicating if all pairs are equal. Code:
|