Python for range syntax

Asked 2 years ago, Updated 2 years ago, 22 views

pp=[]
for i in range(12):
    pp.append([])
    for j in range(12):
        pp[i].append(0)

for i in range(10):
    a=input().split()
    for j in range(10):
        pp[i+1][j+1]=int(a[j])

When I make a list called pp, I make a size of 10x10, but why do I make it by setting a range of 12?

python

2022-09-20 10:50

1 Answers

Maybe they're trying to apply a convolution filter or they're making a border to make sure they're leaving the edge of the grid.


2022-09-20 10:50

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.