Posts by William • 109 points
3 posts
-
8
votes0
answers6171
viewsQ: How to make all possible combinations to arrive at a proposed result?
Well, let’s start at the beginning, at the beginning, at the beginning. I have this program: from itertools import combinations lis = [1,2,3,4,5,6,7,8,9] for i in (3, len(lis)): for comb in…
-
2
votes1
answer249
viewsQ: How to ignore certain elements in a list that will go through a random process? (pending)
This program finds 3x3 magic squares by brute force and prints automatically when it encounters a. code: import random vetor = [1, 2, 3, 4, 5, 6, 7, 8, 9] def magicsquare(): return…
-
-1
votes1
answer534
viewsQ: I wanted to make a magic square, where I put 9 numbers, and the sum of them has to result 15 (horizontal and vertical)
Good evening guys, I have this matrix: I need the matrix numbers summed all 15. Both vertical and horizontal.. Code: import numpy as np import random from tabulate import tabulate a =…