Trying to fix my function

后端 未结 2 1857
有刺的猬
有刺的猬 2021-01-28 20:15

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

2条回答
  •  孤独总比滥情好
    2021-01-28 20:23

    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))]
    

提交回复
热议问题