#!/bin/python3
a=int(input())
p,f,el=[],[],0
b='0 '*a
b=b.split()
for s in range(a):
p.append(b)
for li in range (a):
el+=1
p[0][li]=el
print(p)
[[1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5], [1, 2, 3, 4, 5]]
[[1, 2, 3, 4, 5], ['0', '0', '0', '0', '0'], ['0', '0', '0', '0', '0'], ['0', '0', '0', '0', '0'], ['0', '0', '0', '0', '0']]
Почему в двумерном массиве каждый подмассив становится копией другого
Assignment statements in Python do not copy objects, they create bindings between a target and an object. For collections that are mutable or contain mutable items, a copy is sometimes needed so one can change one copy without changing the other. This module provides generic shallow and deep copy operations (explained below).
new_list = old_list.copy()
# или
new_list = old_list[:]
import copy
new_list = copy.deepcopy(old_list)