I noticed two things that I think you can improve in your 8queens.py code. The first is on line 4. You have board = '........\n........\n........\n........\n........\n........\n........\n........'. This is a little long. It can be shortened with a for loop. Instead, we could have
`board = ''
for in range(8):
board += '........\n'`. This may or may not be more simple to you, but I like this better.
This second thing I noticed is at the bottom of your code. Twice, on lines 61 and 66, you have print(''). I think this is to have a new line between print('passed') and print('testing random_optimizer on n_vals...'). Instead of having print(''), you can just put \n in front of 'testing random_optimizer on n_vals...'. It should look like this: print('\ntesting random_optimizer on n_vals...'). This will make a new line before the 'testing random_optimizer on n_vals...' is printed.
I noticed two things that I think you can improve in your 8queens.py code. The first is on line 4. You have
board = '........\n........\n........\n........\n........\n........\n........\n........'
. This is a little long. It can be shortened with a for loop. Instead, we could have `board = '' for in range(8): board += '........\n'`. This may or may not be more simple to you, but I like this better.This second thing I noticed is at the bottom of your code. Twice, on lines 61 and 66, you have
print('')
. I think this is to have a new line betweenprint('passed')
andprint('testing random_optimizer on n_vals...')
. Instead of havingprint('')
, you can just put\n
in front of'testing random_optimizer on n_vals...'
. It should look like this:print('\ntesting random_optimizer on n_vals...')
. This will make a new line before the'testing random_optimizer on n_vals...'
is printed.