Python学习笔记(4)
2017-02-22 14:33
239 查看
my_name = 'Zed A. Shaw' my_age = 35 # not a lie my_height = 74 # inches my_weight = 180 # lbs my_eyes = 'Blue' my_teeth = 'White' my_hair = 'Brown' print "Let's talk about %s." % my_name print "He's %d inches tall." % my_height print "He's %d pounds heavy." % my_weight print "Actually that's not too heavy." print "He's got %s eyes and %s hair." % (my_eyes, my_hair) print "His teeth are usually %s depending on the coffee." % my_teeth # this line is tricky, try to get it exactly right print "If I add %d, %d, and %d I get %d." % ( my_age, my_height, my_weight, my_age + my_height + my_weight)
运行之后如下:
Let's talk about Zed A. Shaw. He's 74 inches tall. He's 180 pounds heavy. Actually that's not too heavy. He's got Blue eyes and Brown hair. His teeth are usually White depending on the coffee. If I add 35, 74, and 180 I get 289.
相关文章推荐
- Python学习笔记—条件判断和循环
- Python学习笔记012——装饰器
- Python从零学习笔记(1~3)
- Python学习笔记(七)——自我探索模块
- python学习笔记:字典嵌套,将字典作为VALUE加入字典中
- Python学习笔记06_高级特性
- python学习笔记
- python 学习笔记----基本语法
- Google Python Class 学习笔记(2) 正则表达式
- Python学习笔记-Excel读写操作
- Python学习笔记——列表②
- 流畅python学习笔记:第十七章:并发处理二
- python学习笔记-类的descriptor
- Python学习笔记——字符串
- Python学习笔记之抽象
- python学习笔记2--用turtle简单绘图
- python 学习笔记之内置函数
- 树莓派学习笔记——Python SQLite查询历史温度
- 【Python学习笔记】print语句和注释
- Python学习笔记(20)-文件和文件夹的移动、复制、删除、重命名