Smallest Permutation
Given a number, find the permutation with the smallest absolute value (no leading zeros). -20 => -20 -32 => -23 0 => 0 10 => 10 29394 => 23499 The input will always be an integer. Here is my code: def min_permutation(n): digits = list(str(n)) result = sorted(digits) e = ''.join(result) sum = len(str(n)) if n == 0: return 0 elif sum == 2 and '0' in str(n): return n else: return int(e) The test cases are correct but when I press submit half of the test cases are right and the other half is wrong. I want my code to output -20 if n is a 2 digit number and has a 0 in it we return n... Please explain where I'm wrong https://www.codewars.com/kata/5fefee21b64cc2000dbfa875/train/JUMP_LINK__&&__python__&&__JUMP_LINK Please explain where I'm wrong! Or where I have to add something into my code.