i want to change the value of a variable within a for loop, but then have the new preserved variable changed when the loop finishes
my attempt (kinda simplified from what i'm actually doing)
SNP is a list and compar_1 is a list of lists
line_1 = empty_row
for SNP1 in compar_1:
global line_1
if SNP[3] == SNP1[3]
compare_line_1 = SNP1
print = line_1
output_file.write(to_print)
if it finds a match within the loop i want it to change the variable to that so that's what's printed, if it doesn't find a match in the for loop i want it to print the "empty_row" (a string defined earlier)