In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-30 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/01 Report--
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.
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.