lst =[1,4,9,16,2,5,10,15]
length =len(lst)[lst[i]+ lst[i+1]for i inrange(0,length-1)]
正九九乘法表
{print('{}*{}={:<{}}'.format(j,i,j * i,2if j ==1and j * i <10else3),end='\n'if i == j else'')\
for i inrange(1,10)for j inrange(1,i+1)}
倒九九乘法表
{print('{}{}*{}={:<{}}'.format((i-1)*(7*' ')if i == j else'',i,j,i * j,3),end ='\n'if j ==9else'') \
for i inrange(1,10)for j inrange(i,10)}
随机生成100个ID
from random import choices
from string import ascii_lowercase
alphabet = ascii_lowercase
['{:>04}.{}'.format(i,''.join(choices(alphabet,k=10)))for i inrange(1,101)]