def update(all_marks, stud_num, mark, column, result):
lines = [l for l in all_marks]
for row in all_marks:
if stud_num in row:
lines[rows][column] = mark
From here, I am trying to replace the value by using lines[rows][column] = mark.
It is supposed to replace the existing value with mark. But there's a problem with defining rows. Anyone knows how to fix? Thanks.
Edit: Here's sample of data from all_marks:
[['a', '', '', '', '', ''],
['b', '', '', '', '', ''],
['c', '', '', '', '', ''],
['d', '', '', '', '', ''],
['e', '', '', '', '', ''],
['f', '', '', '', '', ''],
['g', '', '', '', '', '']]
What I want to do here is to replace the value in '' with mark.
For example, def update(all_marks, 'a', '10', 2, True): will return
[['a', '', '10', '', '', ''],
['b', '', '', '', '', ''],
['c', '', '', '', '', ''],
['d', '', '', '', '', ''],
['e', '', '', '', '', ''],
['f', '', '', '', '', ''],
['g', '', '', '', '', '']]
Thanks for helping a newbie.