Jump to content

Z12869: Difference between revisions

From Wikifunctions
add a debug printout
move debug and tab indents
Line 14: Line 14:
"Z61K1": "python"
"Z61K1": "python"
},
},
"Z16K2": "def Z12741(Z12741K1, Z12741K2):\r\n if len(Z12741K1) != len(Z12741K2):\r\n return False\r\n\r\n # Define a custom sorting function. It will sort elements first by type, then by value\r\n def custom_sort(element):\r\n return (str(type(element)), element)\r\n\r\n try:\r\n \tWikifunctions.Debug(sorted(Z12741K1, key=custom_sort))\r\n \tWikifunctions.Debug(sorted(Z12741K2, key=custom_sort))\r\n return sorted(Z12741K1, key=custom_sort) == sorted(Z12741K2, key=custom_sort)\r\n except TypeError:\r\n # If there is a TypeError while sorting, it means there were non-comparable types in the list\r\n return False"
"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\tWikifunctions.Debug(sorted(Z12741K1, key=custom_sort))\r\n\tWikifunctions.Debug(sorted(Z12741K2, key=custom_sort))\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"
}
}
},
},

Revision as of 05:37, 27 February 2024

This page displays in a limited way without JavaScript.