Exercise 11: Asking Questions

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)

How do I get a number from someone so I can do math?
That's a little advanced, but try x = int(raw_input()) which gets the number as a string from raw_input() then
converts it to an integer using int().

input ([prompt]) 等同于 eval(raw_input(prompt)) 

posted @ 2014-10-23 09:33  林中细雨  阅读(128)  评论(0编辑  收藏  举报