exercise 12 提示


age = raw_input("How old are you? ")
height = raw_input("How tall are you? ")
weight = raw_input("How much do you weigh? ")
print "So, you're %r old, %r tall and %r heavy." % (
    age, height, weight)


$ python ex12.py
How old are you?  38
How tall are you?  6'2"
How much do you weigh?  180lbs
So, you're '38' old, '6\'2"' tall and '180lbs' heavy. 
# 使用%r 会有引号


pydoc ????

ex12
1.print xxxxxxx ,
后面加 逗号 表示下一行的内容与print显示在同一行
我们在每行后加了逗号,这样就不会换行等待输入
2.
version1
How tall are you?
6'2
So, you're '22' old, "6'2" tall and '110' heavy.
version2
How tall are you?
6'2"
So, you're '22' old, '6\'2"' tall and '110' heavy.
3.
age = raw_input("How old are you?")
等价于
print "How old are you?",  
age = raw_input() 
4.
x = int(raw_input())
将输入的字符串转换成int型变量 就可以用作数学计算了

5. pydoc don't understand!!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值