Any Python Programmers Out There??

Ready for a partial core dump? It might stink but there it is.

Code:
PLst = [[2, 0, 4, 5, 7, 0, 3, 2],
[0, 4, 1, 6, 0, 1, 9, 0],
[4, 0, 0, 1, 0, 8, 2, 4],
[1, 5, 0, 0, 5, 0, 0, 2],
[0, 6, 4, 3, 0, 4, 2, 6],
[7, 3, 4, 0, 2, 5, 1, 0],
[0, 1, 6, 7, 1, 0, 0, 2],
[1, 0, 2, 0, 3, 2, 5, 0]]
 
I am new to Python. Though I am an experienced programmer.

Looks like Python doesn't like to handle 2d arrays or matrices or so I thought.

Anyway, you can access the entries in the matrix through PLst[row][col].
 
Anyone wants me to show the result of my code? It uses random numbers and isn't the final solution to the puzzle.
 
I contacted my son and he said this.
.

Your son is correct.

Code:
PLst = [2, 0, 4, 5, 7, 0, 3, 2]
for I in PLst:
    print(I)

Result:
2
0
4
5
7
0
3
2

Notice the number 5? It indexes the 6th number which is 0. It modifies that 0 randomly from 1 to 9. When it's 8 or 9, error message appears.
 
Maybe I am a Drunken Computer Programmer. Like that Drunken Kung Fu Master Jackie Chan? Once he's drunk, all of sudden he's an expert at it.
 
[2, 1, 4, 5, 7, 5, 3, 2] 29
[7, 4, 1, 6, 6, 1, 9, 8] 42
[4, 6, 3, 1, 6, 8, 2, 4] 34
[1, 5, 8, 3, 5, 7, 1, 2] 32
[5, 6, 4, 3, 1, 4, 2, 6] 31
[7, 3, 4, 9, 2, 5, 1, 1] 32
[7, 1, 6, 7, 1, 5, 2, 2] 31
[1, 4, 2, 9, 3, 2, 5, 5] 31
 
Here's another clue:

There are possible values of two or three variables that add up to a number each row. Subtract 30 from known entries and work from there.

Let linear algebra work it's magic for the magic square.
 
Those are possible values for those two unknowns for the first row.

Code:
PLst = [2, 0, 4, 5, 7, 0, 3, 2]
print(sum(PLst))
Sub = 30 - sum(PLst)
print(Sub)
#Clue here
for i in range(1,Sub):
    print(i,Sub - i)

Result

23
7
1 6
2 5
3 4
4 3
5 2
6 1
 
Back
Top