本文介绍了试图修复我的功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在处理一个函数,在该函数中我必须返回一个元组,其中第一个参数是最大数字的str,第二个参数是int的列表.这是示例,以及我为该函数编写的内容:
I'm working on a function where I have to return a tuple where the first parameter is a str of the highest number and the second parameter is a list of int. Here's the example and what I wrote for the function:
投票(['G','G','N','G','C']) ("G",[1、3、0、1]) ""
voting(['G', 'G', 'N', 'G', 'C']) ('G', [1, 3, 0, 1]) """
推荐答案
您必须将maxvalue的位置映射到正确的参与方:
You have to map the position of the maxvalue to the correct party:
parties = ['NDP', 'Green', 'Liberal', 'CPC'] winning_party = parties[total.index(max(total))]更多推荐
试图修复我的功能
发布评论