Ad
Arrays
Data Types
Strings
Numbers
Code
Diff
  • def small_big_num(x):
        return [] if not isinstance(x,str) else [sorted([int(i) for i in x if i.isdigit()])[j] for j in (-1,0)]
    • def small_big_num(x):
    • if type(x) != type(''): return []
    • digits = [int(i) for i in x if i.isdigit()]; digits.sort()
    • return [digits[-1], digits[0]]
    • return [] if not isinstance(x,str) else [sorted([int(i) for i in x if i.isdigit()])[j] for j in (-1,0)]