Trying to modify my battleship


#1



so im trying to modify it like it told me i could try to do so i decided to make it easier to find the coordinates so i set it up like this
!! 0!1!2!3!4
0 O O O O
1 O O O O
2 O O O O
3 O O O O
4 O O O O
(its a bit more even in the console)

I managed to get the numbers on top in without problem, except whats happening is that i have no idea how to get the numbers on the side to appear, i tried putting my num[] list on the same print line as the o's but i kept getting a error saying strings and lists cant be combined. I can make it so every side number appears but they all are the same.so i dont know how to make it so each line has a different number


from random import randint
numba = [" ","0", "1", "2","3","4"]

board = []
num = ["1","2","3","4","5"]
for x in range(5):
    board.append(["O"] * 5)

def print_board(board):
    print "!".join(numba)
    for row in board:
        print num + "!" + " ".join(row)
        

print "Let's play Battleship!"
print_board(board)
.


#2

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.