A = [['X', 'X', 'O'],
['X', 'X', 'X'],
['O', 'X', 'X']]
def count_X():
for i in range(3):
total = 0
for j in range(3):
if A[i][j] == 'X':
total += 1
print(total)
Is there any simpler solution without nested for loops O(n²)?