I am trying to make a loop that can roll my dice and assign the rolled value into a list that can then be put through a dictionary to get back the values written in the dictionary. My dictionary is as follows:
scores = {1:1000, 2:200, 3:300, 4:400, 5:500, 6:600} rolls = [] for i in range(5): self.rolls.append(random.randint(1,6)) my_score = 0 How do I make the values in rolls that of the ones in the dictionary and add them to my_score.
my_score += sum(scores[a] for a in rolls)?