Mar-18-2022, 10:46 PM
(This post was last modified: Mar-18-2022, 10:57 PM by CompleteNewb.)
How can i simplify this code?
listplayers = [['player1', 5,1,300,100],['player2', 10,5,650,150],['player3', 17,6,1100,1050]] dictionary = { 'playersname':[] 'totalwin':[] 'totalloss':[] } for x in listplayers: dictionary['playersname'].append(x[0]) dictionary['totalwins'].append(x[1]) dictionary['totalloss'].append(x[2])i know it seems pretty simplified now but if my dictionary and my x has 40 items, it gets pretty tedious to write