Python Ajouter à 2D Table
temp_list = [[], [], [], []]
temp_list[0].append("a1")
temp_list[1].append("a2")
temp_list[2].append("a3")
temp_list[3].append("a4")
Kodi4444
temp_list = [[], [], [], []]
temp_list[0].append("a1")
temp_list[1].append("a2")
temp_list[2].append("a3")
temp_list[3].append("a4")
a_2d_list = [[1, 2], [3, 4]]
a_2d_list.append([5, 6])
new_row.append([])
arr = []
arr.append([])
arr[0].append('aa1')
arr[0].append('aa2')
"""0 shows no error , 1 shows error"""
error_list=[] #main error list
p=0 #p - phone field
e=1 #e - mail field
d=1 #d - date field
temp_error=[] #temporary error list created and to collect data everytime
if(p==1):
temp_error.append('invalid number')
if(e==1):
temp_error.append('invalid email')
if(d==1):
temp_error.append('invalid admit date')
error_list.append(temp_error)
#second call (you can call it recursively too by calling function name)
p=1 #p - phone field
e=0 #e - mail field
d=1 #d - date field
temp_error=[]
if(p==1):
temp_error.append('invalid number')
if(e==1):
temp_error.append('invalid email')
if(d==1):
temp_error.append('invalid admit date')
error_list.append(temp_error)
print(error_list)
#OUTPUT : [['invalid email','invalid admit date'],['invalid number','invalid admit date']]
for i in range(x):
for j in range(y):
z[i][j]=input()