老样子,把源代码乱改了一通:
1 age = input("How od are you? ") 2 height = raw_input("How tall are you? "), ("what?"), raw_input("again ") 3 weight = raw_input("How much do you weight? ") 4 5 print "So,you're %r old, %r tall and %r heavy." %( 6 age, height, weight)
ps. print语句后面太长要换个行,所以最后一行前要加个空格,不然就变成另起新的一行啦!
输出结果如下:
age那儿的raw_input换成了input
height的内容随便加了一坨… 总之 啊 等会的多一点的时候再来研究为啥会这么显示吧hhhh
注:20170910 学习到第19课时候遇到一个问题,尝试用raw_input时报错,翻看到本课,发现换成input就ok了
raw_input() 将所有输入作为字符串看待,返回字符串类型。导致变量%d时报错
input() 返回所输入的数字的类型( int, float )