I'm pretty new to programming, and Python. My textbook has not given me really any information on this and I am stumped now. This is my current code, I need to display the added up columns, and display them like I have the rows.
EDIT:
I had read a few different posts here about using zip() but my book didn't cover it so I couldn't really use it. However this is what I ended up doing:
import random
ROWS = 3
COLS = 3
def main ():
values = [[0, 0, 0],
[0, 0, 0],
[0, 0, 0]]
for r in range (ROWS):
for c in range(COLS):
values[r][c]= random.randint(1,4)
#add up rows
row0=sum(values[0])
row1=sum(values[1])
row2=sum(values[2])
#add up columns
col0=(values[0][0]+values[1][0]+values[2][0])
col1=(values[0][1]+values[1][1]+values[2][1])
col2=(values[0][2]+values[1][2]+values[2][2])
#print results
print ("List: ")
print (values)
print ("Total of row 0 is", row0 )
print ("Total of row 1 is", row1)
print ("Total of row 2 is", row2 )
print ("Total of column 0 is", col0)
print ("Total of column 1 is", col1)
print ("Total of column 2 is", col2)
main()