1星座
for i in range(12): print (chr(9800+i),end="/")
2凯撒
plaincode=input ("请输入明文:") for p in plaincode: if ord("a")<=ord("p")<=ord("z"): print(chr(ord("a")+(ord(p)-ord("a")+3)%26),end="") else: print(p,end="")
3输入姓名,格式输出
a = input(‘name:‘) print(‘the name what you entered: {0:^4}‘.format(a))
4格式化输出:中华人民共和国国内生产总值(GDP)689,136.89亿元(2015年)(千分位、2位小数,浮点数)
print("中华人民共和国国内生产总值(GDP):{0:^-10,.2f}亿元".format(689136.89))
5.99乘法表
for i in range(1,10): for j in range(1,i+1): print(j,"*",i,"=",i*j," ",end=‘‘) print(end=‘\n‘)
原文:http://www.cnblogs.com/lesssharp/p/7543547.html