Create a table based on two user inputs. Have the user enter two integers
between 2 and 6. Validate the user inputs are in the proper range as they are
entered. The first integer represents the number of rows in the table. The
second integer represents the number of columns.
Create the table by storing the value (i **j) in each cell in the table.
Print the Power table with a column header separated from the table by a line
of underscores (“_”) and a row header that lists the row number, a “|” and the
row of data.
This is what I have. I am very confused on what to do.
i = 6
j = 6
row = int(input("Row: "))
column = int(input("Column: "))
if row == 7 :
print("Invalid entry.")
elif row <= 2 or row > 6 :
print("Invalid entry. The row has a range of 2 to 6. Try again.")
if column == 7 :
print("Invalid entry.")
elif column <= 2 or column > 6:
print("Invalid entry. The column has a range of 2 to 6. Try again.")
for n in range(row) :
print("%10d" % n, end="")
print()
for n in range(1, row + 1) :
print("%10s" % "x ", end="")
print("\n", " ", "-" * 35)
for i in range(row):
for j in range (column):
table[i] [j] = int(table[i] [j]) # convert the string to an integer
print(" %3d" % (table[i] [j]), end = " ")
print()
Sent from Windows Mail
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor