what does [...] mean as an output in python?

justinmoon

I'm trying set ships on a Battleship board. The function in the code below should do this with a number of ships and an board (an array of arrays) as arguments. When I run this in Terminal, I get:

[[1, [...]], [1, [...]], [2, [...]]]

What does [...] mean? How to replace [...] with a random integer from 0 to 2 in this output?

from random import randint

def print_board(board):
    for row in board:
        print " ".join(row)
def random_row(board):
    return randint(0, len(board) - 1)
def random_col(board):
    return randint(0, len(board[0]) - 1)

def set_the_ships(num_ships,board):
    ship_list = []
    for i in range(num_ships):
        ship_row = random_row(board)
        ship_col = random_col(board)    
        position = [ship_row,ship_list]
        for j in range(i - 1):
            while (position[0] == ship_list[j][0] and position[1] == ship_list[j][1]):
                ship_row = random_row(board)
                ship_col = random_col(board)    
                position = [ship_row,ship_list]
        ship_list.append(position)
    return ship_list

print set_the_ships(3,[[0,0,0],[0,0,0],[0,0,0]])
falsetru

... means, there's reference cycle.

>>> l = []
>>> l.append(l)
>>> l
[[...]]

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

What does `{...}` mean in the print output of a python variable?

From Dev

what does this nm output mean?

From Dev

What does # mean in ls output

From Dev

what does this output of ls mean?

From Dev

What does this diagnostic output mean?

From Dev

What does |= mean in python?

From Dev

What does ,= mean in python?

From Dev

What does *= mean in python?

From Dev

what does [[...]] mean in python?

From Dev

What does `<-`, `>-`, `<+`, `>+` in python mean?

From Dev

What does """ mean in python?

From Dev

What does (.eh) mean in nm output?

From Dev

What does "perf stat" output mean?

From Dev

What does the Brown clustering algorithm output mean?

From Java

What does the slash mean in help() output?

From Dev

What does mean the "permanent" word in the "arp -a" output?

From Dev

What does "book" mean in the output of 'lscpu -p'?

From Dev

What does the asterisk mean in rspec output

From Dev

What does the fps mean in the ffmpeg output?

From Dev

Jenkins console output: What does A and AU mean?

From Dev

What does the the output of following code snippet mean?

From Dev

What does '(:0)' in the output of the command 'who' mean?

From Dev

What does (.:format) mean in rake routes' output?

From Dev

What does <defunct> mean in the output of ps?

From Dev

What does the asterisk in the netstat output mean?

From Dev

What does “book” mean in the output of 'lscpu -p'?

From Dev

What does & mean exactly in output redirection?

From Dev

What does the asterisk mean in rspec output

From Dev

What does the output of 'ss -s' mean?