1.恺撒密码的编码
plaincode=input('明文:') print('密文:',end='') for i in plaincode: print(chr(ord(i)+3),end='')
2.GDP格式化输出
print('国家名称'+' '+'GDP总量(人民币亿元)') print("{0: <10} ¥{1: >13,.2f}".format('中国',765873.4375)) print("{0: <10} ¥{1: >9,.4f}".format('澳大利亚',78312.4375))
3.99乘法表
for i in range(1,10): for j in range(1,i+1): print('{}*{}={:2}'.format(j,i,i*j),end=' ') print(' ')