Z12869: Difference between revisions
protection for lists with elements of multiple types |
Converting reference to programming language to use an ID |
||
(7 intermediate revisions by one other user not shown) | |||
Line 10: | Line 10: | ||
"Z14K3": { |
"Z14K3": { |
||
"Z1K1": "Z16", |
"Z1K1": "Z16", |
||
"Z16K1": |
"Z16K1": "Z610", |
||
⚫ | "Z16K2": "def Z12741(Z12741K1, Z12741K2):\r\n\tif len(Z12741K1) != len(Z12741K2):\r\n\t\treturn False\r\n\r\n\t# Define a custom sorting function. It will sort elements first by type, then by value\r\n\tdef custom_sort(element):\r\n\t\treturn (str(type(element)), element)\r\n\r\n\ttry:\r\n\t\treturn sorted(Z12741K1, key=custom_sort) == sorted(Z12741K2, key=custom_sort)\r\n\texcept TypeError:\r\n\t\t# If there is a TypeError while sorting, it means there were non-comparable types in the list\r\n\t\treturn False" |
||
"Z1K1": "Z61", |
|||
"Z61K1": "python" |
|||
}, |
|||
⚫ | "Z16K2": "def Z12741(Z12741K1, Z12741K2):\r\n |
||
} |
} |
||
}, |
}, |
Latest revision as of 16:16, 22 May 2024
This page displays in a limited way without JavaScript.