How to skip a line in a python nested list

Question:

I was trying to make a code in pyh=thon, which contain a nested list. Each list will be in a different line.

line1=list((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0))
line2=list((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0))
arena=list()
arena.append(line1)
arena.append('/n')
arena.append(line2)

However the outpoot is
[[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], 'n', [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]]

How to make it to skip a line?

Asked By: Kserdas

||

Answers:

You can print each item of a list on a separate line by specifying the ‘sep’, or separator, parameter of print(). By default, this parameter is a space, but we can set it to ‘n’:

line1=list((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0))
line2=list((0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0))

arena=list()
arena.append(line1)
arena.append(line2)    

# Print unpacked list with separator parameter set to 'n'
print(*arena, sep='n')

Output:

[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
Answered By: cvionis
Categories: questions Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.