Can't make my board print columns from 1 to 5 rather than 0 to 4


Hey guys I am very new to this and I'm having a pretty hard time figuring out how some of it works.

So basically I was messing around with the Battleship lesson for a a few hours to try and tweak a few things and there is one thing that I can't seem to figure out.

I've been trying to print the 5 x 5 board with rows and columns from 1 to 5 rather than from 0 to 4 as it is by default. I've gotten to a point in which as I input the rows from 1 to 5 they match up perfectly, but I can't figure out how to do the same with the columns, which keep printing out as 0 to 4 and so if I input numbers from 1 to 5 the "X" that I set it to show up on the spot where the shot misses is always one column further.

For example, if I input row: 1, column: 2 -> the X would be in what on my board I numbered as row 1, column 3. I'm thinking the way around this should be with another loop inside the one I use for printing the board but I couldn't figure out how.

I managed to slice the 0 position from the rows so that it only prints out from the 1st position onwards, but Im not having any luck with the columns.

Any help would be highly appreciated,

from random import randint

# Board list to fill 
board = []

# Numbering rows and columns
row_num = ["1", "2", "3", "4", "5"]

columns = ["  1", "2", "3", "4", "5"]

for x in range(6):
    board.append(["O"] * 5)

# Rows are working from 1 to 5, columns still 0 to 4.
def print_board(board):
    row_num = 1
    print "\t\t", "   ".join(columns)
    for row in board[1:]:# Using [1:] only prints the rows 1 to 5 instead of 0 to 4 but columns are still printing from 0 to 4
        print "\t\t", row_num, "   ".join(row)
        row_num += 1 

print "Let's play Battleship!"
print "You have four guesses."

# Defining a random int for the battleship location
# Managed to define the number from 1 to 5 rather than 0 to 4 by changing the code randint(0, len(board) - 1)

def random_row(board):
    return randint(1, len(board) - 1)

def random_col(board):
    return randint(1, len(board[1]) - 1)

ship_row = random_row(board)
ship_col = random_col(board)
print ship_row
print ship_col

# Loop and outcome answers

for turn in range(4):
    guess_row = int(raw_input("Guess Row:"))
    guess_col = int(raw_input("Guess Col:"))

    if guess_row == ship_row and guess_col == ship_col:
        board[ship_row][ship_col] = "S"
        print "Congratulations! You sunk my battleship!"
        if (guess_row < 1 or guess_row > 5) or (guess_col < 1 or guess_col > 5):
            print "Oops, that's not even in the ocean."
        elif(board[guess_row][guess_col] == "X"):
            print "You guessed that one already."
            print "You missed my battleship!"
            board[guess_row][guess_col] = "X"
        if turn == 3:
            print "Game Over"
        print "Turn", turn + 2


given you are working in python, and lists are zero indexed based, its pretty tricky to change. Change the user input however, is a lot easier. You could simply subtract one from the user input? This way the user can count from 1 till 5 (inclusive) while python can work with 0 till 4 (inclusive)


Thanks! That worked perfectly well