Display a table with entered rows and columns | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Display a table with entered rows and columns

In the function using python3 write code that will input two positive integers r and c and display a table with r rows and c columns, where the value of the mth number in the nth row is mn, e.g. 1 1 1 1 2 4 8 16 3 9 27 81 4 16 64 256 5 25 125 625 The table should have columns of equal width and all numbers should be right-aligned; the required column width should be obtained by calculating the width needed for the largest number in the table

13th Nov 2017, 8:03 AM
Earl
3 Answers
+ 1
check these codes cause my result does not come """ display a table """ x=int(input("enter row:")) y=int(input("enter column")) b=1 a=1 while b<=x: i=0 area="" while a<y: area=area+format(b**a,">5d") i=i+1 a=a+1 a=1 b=b+1 print("area")
15th Nov 2017, 8:50 AM
Earl
+ 9
Do your own homework. If you're stuck, provide the code and specify your problem.
13th Nov 2017, 10:34 AM
qwerty
qwerty - avatar
0
wats wrong with the code
15th Nov 2017, 10:54 AM
Earl