Having some difficulty here. My goal is to read numbers from a column in a gameboard and print these numbers out as a specific list. I don’t have much experience with lists and neither do I grasp the concept properly so I’m having some difficulty with getting them to work. So far, all I could muster was this:
def getColumn ():
for i in range (0, 9):
row = datalist[i]
column = row[x]
column.append[i]
Doesn’t seem to work properly, could anyone point out why? I would really appreciate it!
Thanks!
Here’s a version that tweaks your original code:
Which gives:
Some problems with your original code:
getColumnwhich column you wanted- you need to make this an argument of your functiongetColumnrelied on there being a global variable calleddatalist. Passing the data as an argument is safer.datalisthad to have exactly nine rows, or you’d get errors or wouldn’t get the full column returned.