DEV Community

loading...

Discussion on: Daily Challenge #48 - Facebook Likes

Collapse
hectorpascual profile image
Héctor Pascual

Python goes there :

def likes(*args):
    return {
        1: f'{args} likes this.',
        2: f'{args[0]} and {args[1]} likes this.',
        3: f'{args[0]}, {args[1]} and {args[2]} likes this.',
        4: f'{args[0]}, {args[1]} and {len(args)-2} others likes this.',
    }.get(len(args) if len(args) < 4 else 4)