码迷,mamicode.com
首页 > 其他好文 > 详细

凯撒密码、GDP格式化输出、99乘法表

时间:2017-09-19 15:05:10      阅读:112      评论:0      收藏:0      [点我收藏+]

标签:div   99乘法表   for   blog   千分位   col   乘法   com   style   

1.恺撒密码的编码

placode=input(‘明文:‘)
print(‘密文:‘,end=‘‘)
for i in placode:
    print(chr(ord(i)+3),end=‘‘)

技术分享

 

2.国家名称 GDP总量(人民币亿元)
中国 ¥765873.4375
澳大利亚 ¥ 78312.4375
(国家名称左对齐,数字右对齐,千分位,2位小数)

print(‘国家名称 GDP总量(人民币亿元)‘)
print(‘{0:‘ ‘<8}¥{1:‘ ‘>10,.2f}‘.format(‘中国‘,765873.4375))
print(‘{0:‘ ‘<8}¥{1:‘ ‘>10,.2f}‘.format(‘澳大利亚‘,78312.4375))

技术分享

 

3.打出99乘法表

 

print(‘99乘法表‘)
for x in range(1,10):
    for y in range(1,x+1):
        print(‘{}*{}={:2}‘.format(y,x,x*y),end=‘ ‘)
    print(‘ ‘)
     

技术分享

凯撒密码、GDP格式化输出、99乘法表

标签:div   99乘法表   for   blog   千分位   col   乘法   com   style   

原文地址:http://www.cnblogs.com/suxihong/p/7550993.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!