Answer the question
In order to leave comments, you need to log in
Problem with adding elements to a dictionary using a for loop. What can be done?
Hello!
There is a code:
class Move(object):
"""Описывает ход игроков и сопутствующие методы"""
@staticmethod
def who(trump, my_hand, comp_hand):
trumps = {'MY': [], 'COMP': []}
for i in my_hand.cards:
if trump in i:
trumps['MY'] += i
for j in comp_hand.cards:
if trump in j:
trumps['COMP'] += j
print(trumps)
{ 'MY' : ['10h', 'Кs', 'Ah', '9d', '10s', 'Кh'] }
{'MY': ['В', 's'], 'COMP': ['К', 's', '1', '0', 's']}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question