How to realize 99 multiplication table with python code
How to use python code to achieve 99 multiplication table, many novices are not very clear about this, in order to help you solve this problem, the following editor will explain in detail for you, people with this need can come to learn, I hope you can get something.
Program analysis: branch and column consideration, a total of 9 rows and 9 columns, I control row, j control column.
Program code: for i in range (0j10): for j in range (1 d*%d=%d 1): print ("% d*%d=%d"%), end= ") print (")
The output result of the program:
1 "1" 1 "2" 2 "2" 2 "4" 4 "3" 3 "3" 6 "3" 9 4 "4" 4 "4" 4 "8 4" 3 "12 4" 4 "16 5" 1 "5" 2 "10 5" 3 "15 5" 4 "20 5" 25 6 "6" 6 "12 6" 18 6 "24 6" 5 "30 6" 36 7 "7" 7 "2" 14 7 "3" 21 7 "7" 7 "3" 21 7 "7" 49 8 "35" 7 "42 7" 7 "49 8" 35 "8" 8 "8" 324 "832" 540 8 "648" 856 "864" 919 "918" 927 "9436" 9 "5" 45 9 "6 54 9" 63 9 "8" 72 9 "9" 81
Does it feel very simple? it only takes 4 lines of code, two loops, and I loops 0 to 9. I starts at 1 every time, and ends with I at that time, so the 99 multiplication table is output in an orderly way.
In the third line, end= "" means no line wrapping after output
The fourth line is just for you to see whether it is helpful for you to output a new line after the space is output after the j loop is finished. If you want to know more about the relevant knowledge or read more related articles, please follow the industry information channel, thank you for your support.