Hide... I know my code looks long but it's not i swear

#1

``````#Created variable 'board' and left them blank.
board = []

#we make a 'for' loop, that goes from 0 -> 5
for w in range(0, 5):
#.append adds O's to the [], so ['O'] * 2 = ['O' , 'O']
board.append(["O"] * 5)

#Create a function
def print_board(x):
#so 'board' is essentially this right now vv
#[['a' , 'b'] , ['1' , '2']]

for row in x:
#this code makes it look like this vv
#['a' , 'b']
#['1' , '2']

print (" ".join(row))
# ^^ " ".join will make the spaces dissapear

#now we create 2 functions 'random_row' and 'random_col'

def random_row(x):
#this 'creates' a boat that's 0
#len(x) sees how long x is (5) and make it 1 less
return randint(0 , len(x) - 1)

def random_col(x):
#this 'creates' a boat that's 0
#len(x) sees how long x is (5) and make it 1 less
return randint(0 , len(x) - 1)``````

It gives me the error: did you create the function random_row? which... i did? is this a glitch?

``````def random_row(x):
#this 'creates' a boat that's 0
#len(x) sees how long x is (5) and make it 1 less
return randint(0 , len(x) - 1)

def random_col(x):
#this 'creates' a boat that's 0
#len(x) sees how long x is (5) and make it 1 less
return randint(0 , len(x) - 1)``````

#2

did you remember to import `randint`?

#3

... wow, yeah all i had to do was import randint... thanks man

#4