def solution(args):
    print(args)
    # your code here
    
    jesus = ""
    mango = []
    
    for i in args:
        if i in mango:
            continue
        mango.append(i)
        j = i + 1
        if j not in args:
            if i == args[0]:
                jesus += str(i)
            else:
                jesus += ',' + str(i)
            continue
        while j in args:
            j += 1
            if j not in mango:
                mango.append(j)
        if i == args[0]:
            jesus += str(i) + '-' + str(j)
        else:
            jesus += ',' + str(i) + '-' + str(j)
            
            
    return jesus

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: