1, the output Jiujiushengfa formulas
for i in range(1,10): for j in range(1,i+1): print('{}*{}={}'.format(j,i,i*j),end=' ') print()
2, bubble sort
li = [1,55,5,9,6,45,2 ] for i in range (len (li) -1 ): for j in range (len (li) -1- i) if li [j] > li [j + 1 ]: li [j], li [j +1] = li [j + 1 ], li [j] print (li)
3, and the calculation 1 + 2 + 3 + 4 + 100
s = 0 for i in range(101): s = s + i print("1+2+3+4+.....100={}".format(s))
4, 1,2,3,4 figures, the number of other with no repeat of the triple-digit figures can be composed? How much are?
= S 0 for I in Range (l, 5 ): for J in Range (l, 5 ): for K in Range (l, 5 ): IF I = J! and J = K! and I =! K: S . 1 + S = Print ( " other with no repeated three digits is: {}, {}, {} " .format (I, J, K)) Print ( " composed of three other with no repeated a number of bits of {} " .format (S)
5, Feibolaqi series, also known as the golden section number of columns, referring to such a series: 0,1,1,2,3,5,8,13,21,34 .........
a,b = 0,1 print(0,b,end=' ') while b < 100: a,b = b,a+b print(b,end=' ')
6, it is determined how many prime numbers between 101-200 and the outputs of all primes
count = 0 for i in range(101,200): flag = 1 for j in range(2,i): if i % j == 0: flag = 0 break if flag != 0: count += 1 print(i,end=' ') print('') print("101-200之间的素数共为:{}".format(count))