import random


board = ''
stones = []
pile = 0
ran_pile = random.randint(2, 5)
write_board = True
while write_board == True:
    pile += 1
    stones.append(f'{pile}: ' + 'O ' * random.randint(1, 9))
    if pile == ran_pile:
        write_board = False
print(stones)


for pile1 in stones:
    board = (f'{board}{pile1}\n')
print(board)


pile2 = 1
ammount = 2
chosen_pile = stones[pile2]
print(chosen_pile)
print(chosen_pile[:-ammount * 2])

print(stones.count('O'))