import functools
def isnum(a):
try:
num = float(a)
return True
except:
return False
def compare(a, b):
if isnum(a) and isnum(b):
if float(a) < float(b):
return -1
else:
return 1
elif not isnum(a) and not isnum(b):
if a < b:
return -1
else:
return 1
elif isnum(a) and not isnum(b):
return -1
else:
return 1
nombres = ['1', 'Hola', '100', 'mundo', '15.34', '10', 'Abba' ]
nombres.sort(key=functools.cmp_to_key(compare))
print(nombres)