- #1
mr.me
- 49
- 0
My assignment was to "create a Python script that will allow the user to input the starting value for the row and column of a multiplication table and then print to screen the table containing ten columns and ten rows. Include a header for each row and column"
I was able to produce the calculated table and I was able to produce a header for each row, but not each column, I do not know where to put the print statement for such a thing, when I fiddle with it always prints incorrectly.
Any suggestions ?
The attempt at a solution__
I was able to produce the calculated table and I was able to produce a header for each row, but not each column, I do not know where to put the print statement for such a thing, when I fiddle with it always prints incorrectly.
Any suggestions ?
The attempt at a solution__
Code:
row = int(raw_input("Enter the first row number: " ))
#These 2 lines prompt the user for input and store the value in "row" and "col"
col = int(raw_input("Enter the frist column number: "))
lastRow = row + 10 # These lines assign and store the value of the variables
firstCol = col
lastCol = col + 10
while (row < lastRow): #This line creates the conditions in which both loops operate
print row,"|", #Prints a header for each row
while(col < lastCol): #This line creates the conditions for the inner loop
print "%3d" %(col * row), #This line will calculate /print the values of the variables
col +=1 #This line updates the value for which "col"
col = firstCol
row +=1 #This line updates the value for "row"
print