《笨办法学python》源码 Ex11.py



#-------------------------------------------------------------------------------
# Name:        ex_11.py
# Purpose:     类型转换.
#
# Author:      huanghuan
#
# Created:     14-08-2013
# Copyright:   (c) huanghuan 2013
# Licence:     <your licence>
#-------------------------------------------------------------------------------


# 注意raw_input()把输入,当作字符串处理.
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)

# 将输入字符串,转换成整型.
print "x=",
x = int (raw_input())

print x

# 技巧写法.参数里,加提示信息
y = int (raw_input("y= "))
print "y = ", y

你可能感兴趣的:(《笨办法学python》源码 Ex11.py)