本帖最后由 sunrise085 于 2020-9-4 17:18 编辑
一行打印几个?从多少打印到多少?
一行十个,从1到100?
for i in range(1,101):#从1到100
print("{0:^3d}*{0:^3d}*{0:^3d} = {1:<6d}".format(i,i**3),end = " ")
if not i%5:#一行打印五个
print()
1 * 1 * 1 = 1 2 * 2 * 2 = 8 3 * 3 * 3 = 27 4 * 4 * 4 = 64 5 * 5 * 5 = 125
6 * 6 * 6 = 216 7 * 7 * 7 = 343 8 * 8 * 8 = 512 9 * 9 * 9 = 729 10 *10 *10 = 1000
11 *11 *11 = 1331 12 *12 *12 = 1728 13 *13 *13 = 2197 14 *14 *14 = 2744 15 *15 *15 = 3375
16 *16 *16 = 4096 17 *17 *17 = 4913 18 *18 *18 = 5832 19 *19 *19 = 6859 20 *20 *20 = 8000
21 *21 *21 = 9261 22 *22 *22 = 10648 23 *23 *23 = 12167 24 *24 *24 = 13824 25 *25 *25 = 15625
26 *26 *26 = 17576 27 *27 *27 = 19683 28 *28 *28 = 21952 29 *29 *29 = 24389 30 *30 *30 = 27000
31 *31 *31 = 29791 32 *32 *32 = 32768 33 *33 *33 = 35937 34 *34 *34 = 39304 35 *35 *35 = 42875
36 *36 *36 = 46656 37 *37 *37 = 50653 38 *38 *38 = 54872 39 *39 *39 = 59319 40 *40 *40 = 64000
41 *41 *41 = 68921 42 *42 *42 = 74088 43 *43 *43 = 79507 44 *44 *44 = 85184 45 *45 *45 = 91125
46 *46 *46 = 97336 47 *47 *47 = 103823 48 *48 *48 = 110592 49 *49 *49 = 117649 50 *50 *50 = 125000
51 *51 *51 = 132651 52 *52 *52 = 140608 53 *53 *53 = 148877 54 *54 *54 = 157464 55 *55 *55 = 166375
56 *56 *56 = 175616 57 *57 *57 = 185193 58 *58 *58 = 195112 59 *59 *59 = 205379 60 *60 *60 = 216000
61 *61 *61 = 226981 62 *62 *62 = 238328 63 *63 *63 = 250047 64 *64 *64 = 262144 65 *65 *65 = 274625
66 *66 *66 = 287496 67 *67 *67 = 300763 68 *68 *68 = 314432 69 *69 *69 = 328509 70 *70 *70 = 343000
71 *71 *71 = 357911 72 *72 *72 = 373248 73 *73 *73 = 389017 74 *74 *74 = 405224 75 *75 *75 = 421875
76 *76 *76 = 438976 77 *77 *77 = 456533 78 *78 *78 = 474552 79 *79 *79 = 493039 80 *80 *80 = 512000
81 *81 *81 = 531441 82 *82 *82 = 551368 83 *83 *83 = 571787 84 *84 *84 = 592704 85 *85 *85 = 614125
86 *86 *86 = 636056 87 *87 *87 = 658503 88 *88 *88 = 681472 89 *89 *89 = 704969 90 *90 *90 = 729000
91 *91 *91 = 753571 92 *92 *92 = 778688 93 *93 *93 = 804357 94 *94 *94 = 830584 95 *95 *95 = 857375
96 *96 *96 = 884736 97 *97 *97 = 912673 98 *98 *98 = 941192 99 *99 *99 = 970299 100*100*100 = 1000000
|