笨办法05更多的变量和打印
来源:互联网 发布:sql decode函数 编辑:程序博客网 时间:2024/05/29 01:55
my_name = 'Kuro Nico'my_age = 35 - 5 # Oh, no!heightcm = 7 * 10 + 4my_height = heightcm * 2.54 # inchesmy_weight = 10 % 4 * 90 # lbsmy_eyes = 'Blue'my_teeth = 'White'my_hair = 'Brown'print "Let's talk about %s." % my_nameprint "He's %d inches tall." % my_heightprint "He's %d pounds heavy." % my_weightprint "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 rightprint "If I add %d, %d, and %d I get %d." %(my_age, my_height, my_weight, my_age + my_height + my_weight)
输出结果:
以下精度宽度表示方法:
# coding: utf-8from math import piprint 'pi: %.10f' % pi # 精度(小数点位数)10print 'pi: %9f' % pi # 宽度(字符数)9print '%*.*s' %(20,7, 'May I help you?') # 使用*作为精度和宽度,数值会从元组参数中读出
输出结果:
阅读全文
0 0
- 笨办法05更多的变量和打印
- 《笨办法学python》---更多的变量和打印
- 笨办法学python习题5 更多的变量和打印
- 习题5更多的变量和打印_笔记(笨办法学Python 第4版)
- python05 更多的变量和格式化打印
- 习题5 更多的变量和打印
- 习题5--更多的变量和打印
- 笨办法07更多打印
- 练习5——更多的变量和打印
- 笨方法学Python 习题 5: 更多的变量和打印
- 笨方法学习Python-习题5:更多的变量和打印
- 笨办法学python习题7 更多打印
- Learn Python The Hard Way学习(5) - 更多的变量和打印
- python07 更多的打印
- 变量的更多内容
- 变量的更多内容
- 笨办法19函数和变量
- 笨办法08打印,打印
- frame for "Collection View" will be different at run time Swift3 iOS 10
- 自定义注解
- numpy 创建数组
- 两数组的交(2)
- c++学习(九)
- 笨办法05更多的变量和打印
- Windows安装配置Redis
- google登录 java获取用户信息
- 解决 RHEL 7/ CentOS 7/Fedora 出现Unit iptables.service failed to load
- 高通camera bring up软件流程
- My97DatePicker日期控件的用法
- Visual Studio SDK介绍
- 中位数
- CMake 指定gcc编译版本