python的代码不理解,题很简单,只是这种解法不懂

实现一个函数likes :: [String] -> String,该函数必须接受输入数组,
其中包含喜欢某个项目的人的姓名。它必须返回显示文本,如示例所示:
likes([]) # must be "no one likes this"
likes(["Peter"]) # must be "Peter likes this"
likes(["Jacob", "Alex"]) # must be "Jacob and Alex like this"
likes(["Max", "John", "Mark"]) # must be "Max, John and Mark like this"
likes(["Alex", "Jacob", "Mark", "Max"]) # must be "Alex, Jacob and 2 others like this"

def likes(names):
    n = len(names)
    return {
        0: 'no one likes this',
        1: '{} likes this',
        2: '{} and {} like this',
        3: '{}, {} and {} like this',
        4: '{}, {} and {others} others like this'
    }[min(4, n)].format(*names[:3], others=n-2)  #这一行不懂
print(likes(["Alex", "Jacob", "Mark", "Max", "Mark", "Max", "Mark", "Max"]))

输出 Alex, Jacob and 6 others like this

拆解来看,可以分为三部分,一个字典、通过字典下标获取对应字符串、通过format函数格式化字符串。
字典很好理解,根据list的长度分为5种情况。
如何将list长度和字典的访问对应?显然,设n=len(list),当n<4是,直接用dict[n]就可以,当n>=4时,要用dict[4],所以显然是访问4和n的最小值,
所以第二部分是[min(4,n)]
第三部分是python格式化字符串的语法,可以在字符串中使用{},并对字符串调用format函数来在{}处插入变量。可以用数字来指定使用变量的下标,还可以设置命名参数来指定变量的位置,比如"{x},{1},{0}".format("A","B",x="x")就会得到字符串x,B,A