for i in range(1,10):
for j in range(1,i+1):
print(f"{j}*{i}={i*j}",end='\t')
print()
运行结果如下:
L = []
for i in range(2,10):
flag = True
for j in range(2,i): #这就不包括1和本身了
if i % j == 0:
flag = False
break
if flag == True:
L.append(i)
print(sum(L))
2022-10-06 18:48:54
for i in range(1,10):
for j in range(1,i+1):
print(f"{j}*{i}={i*j}",end='\t')
print()
运行结果如下:
L = []
for i in range(2,10):
flag = True
for j in range(2,i): #这就不包括1和本身了
if i % j == 0:
flag = False
break
if flag == True:
L.append(i)
print(sum(L))