Any Python Programmers Out There??

There'll be more puzzles, but for now I want to concentrate on this one.

Found this web site: https://discuss.python.org

Posted my question there last night. Included the code I had written. Two people responded. One said the reason I got the same numbers every time is because when the list is modified, there are no zeros in it. I start with

[2, 0, 4, 5, 7, 0, 3, 2] The function modifies it to
[2, 4, 4, 5, 7, 9, 3, 2]

That doesn't sum to thirty, so program send it through function again. But this time, it sends the MODIFIED list through. There are no zeros this time, so list never changes.

When I read that, I thought, "That is so obvious! Why didn't I see that?? I must be really dumb."

So I changed program:

ALst = [1, 2, 3, 4, 5, 6, 7, 8, 9] # Don't use `ALst.'
OldHLine0 = [2, 0, 4, 5, 7, 0, 3, 2]
OldHLine1 = [0, 4, 1, 6, 0, 1, 9, 0]
OldHLine2 = [4, 0, 0, 1, 0, 8, 2, 4]
OldHLine3 = [1, 5, 0, 0, 5, 0, 0, 2]
OldHLine4 = [0, 6, 1, 3, 0, 4, 2, 6]
OldHLine5 = [7, 3, 4, 0, 2, 5, 1, 0]
OldHLine6 = [0, 1, 6, 7, 1, 0, 0, 2]
OldHLine7 = [1, 0, 2, 0, 3, 2, 5, 0]
HLine1 = OldHLine1

def RShuf (ALst, HLst):
--- for I, Value in enumerate (HLst):
------- if Value == 0:
-------- HLst = random.randint (1, 9)

while sum (HLine1) != 30:
-- RShuf (ALst, HLine1)
----- if HLine1 != 30: # This `If' duplicates `While.'
------- HLine1 = OldHLine1 # Added it later.
--- print (HLine1, sum (HLine1))

I thought, "This will do the job. Problem solved!"

However, I'm even dumber than I thought. Still same result. Same digits repeated time after time after time.

So my progress is stalled. For now.


Use copy() method. HLine1 = OldHline1 will cause both to be modified.
 
Pretty much. Magic squares and Sudoku puzzles are related but not exactly the same thing.

The challenge is to find an algorithm using linear algebra to solve it in one sitting.
 
Might not need linear algebra if it's done by brute force. It won't take long anyway. Go across first row and col, find possible values of the missing integers that will result in 30. Go to the next row and col and so on.
 
Progress Report.

While everybody else was ringing in 2021, I was trying to learn about Python Dictionaries.

Excel VBA (And other languages of which I'm aware) have arrays. Python has lists. Dictionaries are (Or can be) arrays of arrays. Can't say I know everything about dictionaries, but I learned enough to use one in my code. Here's what I have so far:

Sed = 3
Ctr = 0
import random
random.seed(Sed)

HDik = {0: [2, 0, 4, 5, 7, 0, 3, 2],
--- 1: [0, 4, 1, 6, 0, 1, 9, 0],
--- 2: [4, 0, 0, 1, 0, 8, 2, 4],
--- 3: [1, 5, 0, 0, 5, 0, 0, 2],
--- 4: [0, 6, 1, 3, 0, 4, 2, 6],
--- 5: [7, 3, 4, 0, 2, 5, 1, 0],
--- 6: [0, 1, 6, 7, 1, 0, 0, 2],
--- 7: [1, 0, 2, 0, 3, 2, 5, 0] }

def RShuf (HLst):
--- for I, Value in enumerate (HLst):
------ if Value == 0:
--------- HLst = random.randint (1, 9)

for Ctr, Value in enumerate (HDik):
--- HLin = HDik [Ctr].copy ()

--- while sum (HLin) != 30:
------ HLin = HDik [Ctr].copy ()
------ Sed += 1
------ random.seed (Sed)
------ RShuf (HLin)
print (Ctr, HDik [Ctr], HLin)
Ctr += 1

And here is the output:

0 [2, 0, 4, 5, 7, 0, 3, 2] [2, 3, 4, 5, 7, 4, 3, 2]
1 [0, 4, 1, 6, 0, 1, 9, 0] [2, 4, 1, 6, 4, 1, 9, 3]
2 [4, 0, 0, 1, 0, 8, 2, 4] [4, 2, 2, 1, 7, 8, 2, 4]
3 [1, 5, 0, 0, 5, 0, 0, 2] [1, 5, 1, 9, 5, 6, 1, 2]
4 [0, 6, 1, 3, 0, 4, 2, 6] [6, 6, 1, 3, 2, 4, 2, 6]
5 [7, 3, 4, 0, 2, 5, 1, 0] [7, 3, 4, 3, 2, 5, 1, 5]
6 [0, 1, 6, 7, 1, 0, 0, 2] [2, 1, 6, 7, 1, 4, 7, 2]
7 [1, 0, 2, 0, 3, 2, 5, 0] [1, 7, 2, 3, 3, 2, 5, 7]

As you can see, program changes the zeros in all eight lines until each adds to thirty. Obviously, I never coulda got this far without help from Niche Political Commentor and A Proud Lefty. Thanks to both of you. (Guille ... Nah. You were precious little help.)

HOWEVER, what I have so far is not good enough. Remember, the goal in the original puzzle was to make all eight horizontal lines AND all eight vertical lines add to thirty.

I strongly suspect getting all the vertical lines to add to thirty is going to be more of a challenge. If a vertical line doesn't add to thirty, that means one or more of the horizontal lines are wrong.

Well, I'm happy I got as far as I did, and I'll dive into the vertical line challenge this weekend.

Happy New Year.
 
While everybody else was ringing in 2021, I was trying to learn about Python Dictionaries.

Excel VBA (And other languages of which I'm aware) have arrays. Python has lists. Dictionaries are (Or can be) arrays of arrays. Can't say I know everything about dictionaries, but I learned enough to use one in my code. Here's what I have so far:

Sed = 3
Ctr = 0
import random
random.seed(Sed)

HDik = {0: [2, 0, 4, 5, 7, 0, 3, 2],
--- 1: [0, 4, 1, 6, 0, 1, 9, 0],
--- 2: [4, 0, 0, 1, 0, 8, 2, 4],
--- 3: [1, 5, 0, 0, 5, 0, 0, 2],
--- 4: [0, 6, 1, 3, 0, 4, 2, 6],
--- 5: [7, 3, 4, 0, 2, 5, 1, 0],
--- 6: [0, 1, 6, 7, 1, 0, 0, 2],
--- 7: [1, 0, 2, 0, 3, 2, 5, 0] }

def RShuf (HLst):
--- for I, Value in enumerate (HLst):
------ if Value == 0:
--------- HLst = random.randint (1, 9)

for Ctr, Value in enumerate (HDik):
--- HLin = HDik [Ctr].copy ()

--- while sum (HLin) != 30:
------ HLin = HDik [Ctr].copy ()
------ Sed += 1
------ random.seed (Sed)
------ RShuf (HLin)
print (Ctr, HDik [Ctr], HLin)
Ctr += 1

And here is the output:

0 [2, 0, 4, 5, 7, 0, 3, 2] [2, 3, 4, 5, 7, 4, 3, 2]
1 [0, 4, 1, 6, 0, 1, 9, 0] [2, 4, 1, 6, 4, 1, 9, 3]
2 [4, 0, 0, 1, 0, 8, 2, 4] [4, 2, 2, 1, 7, 8, 2, 4]
3 [1, 5, 0, 0, 5, 0, 0, 2] [1, 5, 1, 9, 5, 6, 1, 2]
4 [0, 6, 1, 3, 0, 4, 2, 6] [6, 6, 1, 3, 2, 4, 2, 6]
5 [7, 3, 4, 0, 2, 5, 1, 0] [7, 3, 4, 3, 2, 5, 1, 5]
6 [0, 1, 6, 7, 1, 0, 0, 2] [2, 1, 6, 7, 1, 4, 7, 2]
7 [1, 0, 2, 0, 3, 2, 5, 0] [1, 7, 2, 3, 3, 2, 5, 7]

As you can see, program changes the zeros in all eight lines until each adds to thirty. Obviously, I never coulda got this far without help from Niche Political Commentor and A Proud Lefty. Thanks to both of you. (Guille ... Nah. You were precious little help.)

HOWEVER, what I have so far is not good enough. Remember, the goal in the original puzzle was to make all eight horizontal lines AND all eight vertical lines add to thirty.

I strongly suspect getting all the vertical lines to add to thirty is going to be more of a challenge. If a vertical line doesn't add to thirty, that means one or more of the horizontal lines are wrong.

Well, I'm happy I got as far as I did, and I'll dive into the vertical line challenge this weekend.

Happy New Year.


Happy New Year to you too! I am glad to see you making a progress. Did you see my recommendation in post #113?
 
While everybody else was ringing in 2021, I was trying to learn about Python Dictionaries.

Excel VBA (And other languages of which I'm aware) have arrays. Python has lists. Dictionaries are (Or can be) arrays of arrays. Can't say I know everything about dictionaries, but I learned enough to use one in my code. Here's what I have so far:

Sed = 3
Ctr = 0
import random
random.seed(Sed)

HDik = {0: [2, 0, 4, 5, 7, 0, 3, 2],
--- 1: [0, 4, 1, 6, 0, 1, 9, 0],
--- 2: [4, 0, 0, 1, 0, 8, 2, 4],
--- 3: [1, 5, 0, 0, 5, 0, 0, 2],
--- 4: [0, 6, 1, 3, 0, 4, 2, 6],
--- 5: [7, 3, 4, 0, 2, 5, 1, 0],
--- 6: [0, 1, 6, 7, 1, 0, 0, 2],
--- 7: [1, 0, 2, 0, 3, 2, 5, 0] }

def RShuf (HLst):
--- for I, Value in enumerate (HLst):
------ if Value == 0:
--------- HLst = random.randint (1, 9)

for Ctr, Value in enumerate (HDik):
--- HLin = HDik [Ctr].copy ()

--- while sum (HLin) != 30:
------ HLin = HDik [Ctr].copy ()
------ Sed += 1
------ random.seed (Sed)
------ RShuf (HLin)
print (Ctr, HDik [Ctr], HLin)
Ctr += 1

And here is the output:

0 [2, 0, 4, 5, 7, 0, 3, 2] [2, 3, 4, 5, 7, 4, 3, 2]
1 [0, 4, 1, 6, 0, 1, 9, 0] [2, 4, 1, 6, 4, 1, 9, 3]
2 [4, 0, 0, 1, 0, 8, 2, 4] [4, 2, 2, 1, 7, 8, 2, 4]
3 [1, 5, 0, 0, 5, 0, 0, 2] [1, 5, 1, 9, 5, 6, 1, 2]
4 [0, 6, 1, 3, 0, 4, 2, 6] [6, 6, 1, 3, 2, 4, 2, 6]
5 [7, 3, 4, 0, 2, 5, 1, 0] [7, 3, 4, 3, 2, 5, 1, 5]
6 [0, 1, 6, 7, 1, 0, 0, 2] [2, 1, 6, 7, 1, 4, 7, 2]
7 [1, 0, 2, 0, 3, 2, 5, 0] [1, 7, 2, 3, 3, 2, 5, 7]

As you can see, program changes the zeros in all eight lines until each adds to thirty. Obviously, I never coulda got this far without help from Niche Political Commentor and A Proud Lefty. Thanks to both of you. (Guille ... Nah. You were precious little help.)

HOWEVER, what I have so far is not good enough. Remember, the goal in the original puzzle was to make all eight horizontal lines AND all eight vertical lines add to thirty.

I strongly suspect getting all the vertical lines to add to thirty is going to be more of a challenge. If a vertical line doesn't add to thirty, that means one or more of the horizontal lines are wrong.

Well, I'm happy I got as far as I did, and I'll dive into the vertical line challenge this weekend.

Happy New Year.


I don't recall trying to help.
 
Progress Report.

Afraid progress is nonexistent. I wrote code that I seriously expected to work. Replace all the zeros with random numbers. If all sixteen lines add to thirty, YAY. If not, get a new set of random numbers and try again. Unfortunately, I have to report failure. Program has been running now more than sixty hours. If it were going to work, it woulda done it by now. Well, here's the program:

Sed = 3
Ctr = 0
import random
random.seed(Sed)

HDik = {0: [2, 0, 4, 5, 7, 0, 3, 2],
--- 1: [0, 4, 1, 6, 0, 1, 9, 0],
--- 2: [4, 0, 0, 1, 0, 8, 2, 4],
--- 3: [1, 5, 0, 0, 5, 0, 0, 2],
--- 4: [0, 6, 1, 3, 0, 4, 2, 6],
--- 5: [7, 3, 4, 0, 2, 5, 1, 0],
--- 6: [0, 1, 6, 7, 1, 0, 0, 2],
--- 7: [1, 0, 2, 0, 3, 2, 5, 0] }

NewHDik = {}
VDik = {}
AllThirty = False
print ('Working ...')

def RShuf (HLst):
--- for I, Value in enumerate (HLst):
------ if Value == 0:
--------- HLst = random.randint (1, 9)

while (AllThirty == False):

--- for Ctr, Value in enumerate (HDik):
------ HLin = HDik [Ctr].copy ()

------ while sum (HLin) != 30:
--------- HLin = HDik [Ctr].copy ()
-------- Sed += 1
-------- random.seed (Sed)
-------- RShuf (HLin)

------ DCtr = str (Ctr)
------ NewHDik [DCtr] = HLin
------ Ctr += 1

--- VLin0 = NewHDik ['0']
--- VLin1 = NewHDik ['1']
--- VLin2 = NewHDik ['2']
--- VLin3 = NewHDik ['3']
--- VLin4 = NewHDik ['4']
--- VLin5 = NewHDik ['5']
--- VLin6 = NewHDik ['6']
--- VLin7 = NewHDik ['7']

--- VTot0 = VLin0 [0] + VLin1 [0] + VLin2 [0] + VLin3 [0] + \
------ VLin4 [0] + VLin5 [0] + VLin6 [0] + VLin7 [0]
--- VTot1 = VLin0 [1] + VLin1 [1] + VLin2 [1] + VLin3 [1] + \
------ VLin4 [1] + VLin5 [1] + VLin6 [1] + VLin7 [1]
--- VTot2 = VLin0 [2] + VLin1 [2] + VLin2 [2] + VLin3 [2] + \
------ VLin4 [2] + VLin5 [2] + VLin6 [2] + VLin7 [2]
--- VTot3 = VLin0 [3] + VLin1 [3] + VLin2 [3] + VLin3 [3] + \
------ VLin4 [3] + VLin5 [3] + VLin6 [3] + VLin7 [3]
--- VTot4 = VLin0 [4] + VLin1 [4] + VLin2 [4] + VLin3 [4] + \
------ VLin4 [4] + VLin5 [4] + VLin6 [4] + VLin7 [4]
--- VTot5 = VLin0 [5] + VLin1 [5] + VLin2 [5] + VLin3 [5] + \
------ VLin4 [5] + VLin5 [5] + VLin6 [5] + VLin7 [5]
--- VTot6 = VLin0 [6] + VLin1 [6] + VLin2 [6] + VLin3 [6] + \
------ VLin4 [6] + VLin5 [6] + VLin6 [6] + VLin7 [6]
--- VTot7 = VLin0 [7] + VLin1 [7] + VLin2 [7] + VLin3 [7] + \
------ VLin4 [7] + VLin5 [7] + VLin6 [7] + VLin7 [7]

--- Ctr = 0
--- if Sed / 10000000 == int (Sed / 10000000):
------ print (Sed)
--- if (VTot0 == 30 and VTot1 == 30 and
------ VTot2 == 30 and VTot3 == 30 and
------ VTot4 == 30 and VTot5 == 30 and
------ VTot6 == 30 and VTot7 == 30):
--------- AllThirty = True

print () # Blank line.
print (Sed)
print (NewHDik ['0'], sum (NewHDik ['0']))
print (NewHDik ['1'], sum (NewHDik ['1']))
print (NewHDik ['2'], sum (NewHDik ['2']))
print (NewHDik ['3'], sum (NewHDik ['3']))
print (NewHDik ['4'], sum (NewHDik ['4']))
print (NewHDik ['5'], sum (NewHDik ['5']))
print (NewHDik ['6'], sum (NewHDik ['6']))
print (NewHDik ['7'], sum (NewHDik ['7']))

print (VTot0, VTot1, VTot2, VTot3, VTot4, VTot5, VTot6, VTot7)
 
Afraid progress is nonexistent. I wrote code that I seriously expected to work. Replace all the zeros with random numbers. If all sixteen lines add to thirty, YAY. If not, get a new set of random numbers and try again. Unfortunately, I have to report failure. Program has been running now more than sixty hours. If it were going to work, it woulda done it by now. Well, here's the program:

Sed = 3
Ctr = 0
import random
random.seed(Sed)

HDik = {0: [2, 0, 4, 5, 7, 0, 3, 2],
--- 1: [0, 4, 1, 6, 0, 1, 9, 0],
--- 2: [4, 0, 0, 1, 0, 8, 2, 4],
--- 3: [1, 5, 0, 0, 5, 0, 0, 2],
--- 4: [0, 6, 1, 3, 0, 4, 2, 6],
--- 5: [7, 3, 4, 0, 2, 5, 1, 0],
--- 6: [0, 1, 6, 7, 1, 0, 0, 2],
--- 7: [1, 0, 2, 0, 3, 2, 5, 0] }

NewHDik = {}
VDik = {}
AllThirty = False
print ('Working ...')

def RShuf (HLst):
--- for I, Value in enumerate (HLst):
------ if Value == 0:
--------- HLst = random.randint (1, 9)

while (AllThirty == False):

--- for Ctr, Value in enumerate (HDik):
------ HLin = HDik [Ctr].copy ()

------ while sum (HLin) != 30:
--------- HLin = HDik [Ctr].copy ()
-------- Sed += 1
-------- random.seed (Sed)
-------- RShuf (HLin)

------ DCtr = str (Ctr)
------ NewHDik [DCtr] = HLin
------ Ctr += 1

--- VLin0 = NewHDik ['0']
--- VLin1 = NewHDik ['1']
--- VLin2 = NewHDik ['2']
--- VLin3 = NewHDik ['3']
--- VLin4 = NewHDik ['4']
--- VLin5 = NewHDik ['5']
--- VLin6 = NewHDik ['6']
--- VLin7 = NewHDik ['7']

--- VTot0 = VLin0 [0] + VLin1 [0] + VLin2 [0] + VLin3 [0] + \
------ VLin4 [0] + VLin5 [0] + VLin6 [0] + VLin7 [0]
--- VTot1 = VLin0 [1] + VLin1 [1] + VLin2 [1] + VLin3 [1] + \
------ VLin4 [1] + VLin5 [1] + VLin6 [1] + VLin7 [1]
--- VTot2 = VLin0 [2] + VLin1 [2] + VLin2 [2] + VLin3 [2] + \
------ VLin4 [2] + VLin5 [2] + VLin6 [2] + VLin7 [2]
--- VTot3 = VLin0 [3] + VLin1 [3] + VLin2 [3] + VLin3 [3] + \
------ VLin4 [3] + VLin5 [3] + VLin6 [3] + VLin7 [3]
--- VTot4 = VLin0 [4] + VLin1 [4] + VLin2 [4] + VLin3 [4] + \
------ VLin4 [4] + VLin5 [4] + VLin6 [4] + VLin7 [4]
--- VTot5 = VLin0 [5] + VLin1 [5] + VLin2 [5] + VLin3 [5] + \
------ VLin4 [5] + VLin5 [5] + VLin6 [5] + VLin7 [5]
--- VTot6 = VLin0 [6] + VLin1 [6] + VLin2 [6] + VLin3 [6] + \
------ VLin4 [6] + VLin5 [6] + VLin6 [6] + VLin7 [6]
--- VTot7 = VLin0 [7] + VLin1 [7] + VLin2 [7] + VLin3 [7] + \
------ VLin4 [7] + VLin5 [7] + VLin6 [7] + VLin7 [7]

--- Ctr = 0
--- if Sed / 10000000 == int (Sed / 10000000):
------ print (Sed)
--- if (VTot0 == 30 and VTot1 == 30 and
------ VTot2 == 30 and VTot3 == 30 and
------ VTot4 == 30 and VTot5 == 30 and
------ VTot6 == 30 and VTot7 == 30):
--------- AllThirty = True

print () # Blank line.
print (Sed)
print (NewHDik ['0'], sum (NewHDik ['0']))
print (NewHDik ['1'], sum (NewHDik ['1']))
print (NewHDik ['2'], sum (NewHDik ['2']))
print (NewHDik ['3'], sum (NewHDik ['3']))
print (NewHDik ['4'], sum (NewHDik ['4']))
print (NewHDik ['5'], sum (NewHDik ['5']))
print (NewHDik ['6'], sum (NewHDik ['6']))
print (NewHDik ['7'], sum (NewHDik ['7']))

print (VTot0, VTot1, VTot2, VTot3, VTot4, VTot5, VTot6, VTot7)


I showed this to my son and he said your code sucked. You need to learn good programming technique from the start, otherwise you'll just get into bad habits that will be very hard to break.
 
Afraid progress is nonexistent. I wrote code that I seriously expected to work. Replace all the zeros with random numbers. If all sixteen lines add to thirty, YAY. If not, get a new set of random numbers and try again. Unfortunately, I have to report failure. Program has been running now more than sixty hours. If it were going to work, it woulda done it by now. Well, here's the program:

Sed = 3
Ctr = 0
import random
random.seed(Sed)

HDik = {0: [2, 0, 4, 5, 7, 0, 3, 2],
--- 1: [0, 4, 1, 6, 0, 1, 9, 0],
--- 2: [4, 0, 0, 1, 0, 8, 2, 4],
--- 3: [1, 5, 0, 0, 5, 0, 0, 2],
--- 4: [0, 6, 1, 3, 0, 4, 2, 6],
--- 5: [7, 3, 4, 0, 2, 5, 1, 0],
--- 6: [0, 1, 6, 7, 1, 0, 0, 2],
--- 7: [1, 0, 2, 0, 3, 2, 5, 0] }

NewHDik = {}
VDik = {}
AllThirty = False
print ('Working ...')

def RShuf (HLst):
--- for I, Value in enumerate (HLst):
------ if Value == 0:
--------- HLst = random.randint (1, 9)

while (AllThirty == False):

--- for Ctr, Value in enumerate (HDik):
------ HLin = HDik [Ctr].copy ()

------ while sum (HLin) != 30:
--------- HLin = HDik [Ctr].copy ()
-------- Sed += 1
-------- random.seed (Sed)
-------- RShuf (HLin)

------ DCtr = str (Ctr)
------ NewHDik [DCtr] = HLin
------ Ctr += 1

--- VLin0 = NewHDik ['0']
--- VLin1 = NewHDik ['1']
--- VLin2 = NewHDik ['2']
--- VLin3 = NewHDik ['3']
--- VLin4 = NewHDik ['4']
--- VLin5 = NewHDik ['5']
--- VLin6 = NewHDik ['6']
--- VLin7 = NewHDik ['7']

--- VTot0 = VLin0 [0] + VLin1 [0] + VLin2 [0] + VLin3 [0] + \
------ VLin4 [0] + VLin5 [0] + VLin6 [0] + VLin7 [0]
--- VTot1 = VLin0 [1] + VLin1 [1] + VLin2 [1] + VLin3 [1] + \
------ VLin4 [1] + VLin5 [1] + VLin6 [1] + VLin7 [1]
--- VTot2 = VLin0 [2] + VLin1 [2] + VLin2 [2] + VLin3 [2] + \
------ VLin4 [2] + VLin5 [2] + VLin6 [2] + VLin7 [2]
--- VTot3 = VLin0 [3] + VLin1 [3] + VLin2 [3] + VLin3 [3] + \
------ VLin4 [3] + VLin5 [3] + VLin6 [3] + VLin7 [3]
--- VTot4 = VLin0 [4] + VLin1 [4] + VLin2 [4] + VLin3 [4] + \
------ VLin4 [4] + VLin5 [4] + VLin6 [4] + VLin7 [4]
--- VTot5 = VLin0 [5] + VLin1 [5] + VLin2 [5] + VLin3 [5] + \
------ VLin4 [5] + VLin5 [5] + VLin6 [5] + VLin7 [5]
--- VTot6 = VLin0 [6] + VLin1 [6] + VLin2 [6] + VLin3 [6] + \
------ VLin4 [6] + VLin5 [6] + VLin6 [6] + VLin7 [6]
--- VTot7 = VLin0 [7] + VLin1 [7] + VLin2 [7] + VLin3 [7] + \
------ VLin4 [7] + VLin5 [7] + VLin6 [7] + VLin7 [7]

--- Ctr = 0
--- if Sed / 10000000 == int (Sed / 10000000):
------ print (Sed)
--- if (VTot0 == 30 and VTot1 == 30 and
------ VTot2 == 30 and VTot3 == 30 and
------ VTot4 == 30 and VTot5 == 30 and
------ VTot6 == 30 and VTot7 == 30):
--------- AllThirty = True

print () # Blank line.
print (Sed)
print (NewHDik ['0'], sum (NewHDik ['0']))
print (NewHDik ['1'], sum (NewHDik ['1']))
print (NewHDik ['2'], sum (NewHDik ['2']))
print (NewHDik ['3'], sum (NewHDik ['3']))
print (NewHDik ['4'], sum (NewHDik ['4']))
print (NewHDik ['5'], sum (NewHDik ['5']))
print (NewHDik ['6'], sum (NewHDik ['6']))
print (NewHDik ['7'], sum (NewHDik ['7']))

print (VTot0, VTot1, VTot2, VTot3, VTot4, VTot5, VTot6, VTot7)


Question: why would you use random numbers? Why not just iterate numbers?
 
I showed this to my son and he said your code sucked. You need to learn good programming technique from the start, otherwise you'll just get into bad habits that will be very hard to break.

It's what my computer professor used to say, "spaghetti code".
 
Back
Top