作为复习课程,我一直在研究python中的一些内置函数,并希望在这个代码片段中获得一些输入,其中包括列表中出现的大多数事件。
def function(Array):
return max(set(Array), key = Array.count)
# wondering what .count vs .count() does in this situation
发布于 2022-08-04 00:43:39
Array.count将将键设置为它所引用的函数,而Array.count()将运行该函数,并将键设置为函数的返回
https://stackoverflow.com/questions/73229195
复制相似问题