python基本语法

#python3语法
#
print输出 #coding:utf-8 print ("i will count my chickens") print ("hens,母鸡",25+30 / 6) #输出后面加',' print ("rooters,公鸡",100-25*3%4) #变量 cars=100 space_in_a_car=4.0 carpool_capacity=cars*space_in_a_car print ("carpool_capacity",100 / 4.0) my_name = 'zhanglu' my_age = 22 my_height =170#cm print ("Let's talk about %s."%my_name) print ("He's %d cm tall."%my_height) print ("He's %d age."%my_age) #字符串 x = "there are %d types of peopel"%10 binary="binary" do_not="don't" y="these who know %s and those who %s."%(binary,do_not) print (x) print (y) print ("I said:%r"%x) #%r和%s的区别,%r会显示原始数据,用来调试 print ("I also said:%s"%y) #更多打印 print ("alice had a little lamb") print ("Its fleece was white as %s"%'snow') print ("."*10) a1="z" a2="c" a3="s" a4="o" a5="w" a6="q" a7="u" a8="r" a9="y" a10="e" print (a1 + a2 + a3 + a4 + a5 + a6,end='') #增加end='',让输出在一行显示 print (a7+a8+a9+a10)

 

posted on 2017-12-17 13:19  never1211  阅读(66)  评论(0编辑  收藏  举报

导航