import random
k = [[[n for n in range(15)] for _ in range(8)] for _ in range(8)]

A = random.randint(0,7)
B = random.randint(0,7)

for name in range(1024):
    C = random.randint(0,len(k[A][B])-1)
    if (k[A][B][C] == A+B):
        A = random.randint(0,7)
        B = random.randint(0,7)
    else:
        k[A][B].pop(C)
print(f"コンピュータが覚えた式:")
for ak in range(8):
    for ek in range(8):
        if (len(k[ak][ek]) == 1):
            print(f"{ak}+{ek}={k[ak][ek][-1]}")

Embed on website

To embed this project on your website, copy the following code and paste it into your website's HTML: