PRint "How old are you?",
age = raw_input()
print "How tall are you?",
height = raw_input()
print "How much do you weigh?",
weight = raw_input()
print "So, you're %r old, %r tall and %r heavy." % (
age, height, weight)
Note
每行 print 后面加了個逗號(comma) , 這樣的話 print 就不會輸出新行符而結束這一行跑到下一行去了。
結果
$ python ex11.py
How old are you? 35
How tall are you? 6'2"
How much do you weigh? 180lbs
So, you're '35' old, '6/'2"' tall and '180lbs' heavy.
$
加分習題
新聞熱點
疑難解答