#1 by Paula_Tovar
Hi,
I'm trying to use the randomly chosen field from a list for payment.
My code is the following:
for p in players:
a = choice(['S1op1', 'S1op2', 'S1op3', 'S1op4'])
print(a) #Chosen field Ex: 'S1op1'
other = other_player(p)
match = other.a == p.C+a #If S1op1 from the other player and CS1op1 from the current player match, they get paid.
if match:
p.payoff = cu(100)
else:
p.payoff = cu(0)
But I get the error: list' object has no attribute 'a'
How do I access or use the field chosen randomly to create that match condition?
Thank you. :)