在字典中添加值的Python程序

2024-06-24 13:17:11 发布

您现在位置:Python中文网/ 问答频道 /正文

在下面给出的程序中,为什么运行程序后输出中包含“None”?你知道吗

def total_takings(monthly_takings):
    list=[]
    for earnings in monthly_takings:
        list.append(monthly_takings[earnings])
    print(sum(sum(list,[])))



test1= total_takings({'January': [54, 63], 'February': [64, 60], 'March': [63, 49], 'April': [57, 42], 'May': [55, 37], 'June': [34, 32], 'July': [69, 41, 32], 'August': [40, 61, 40], 'September': [51, 62], 'October': [34, 58, 45], 'November': [67, 44], 'December': [41, 58]})

print(test1)

Tags: in程序nonefordeflisttotalsum