print "This program converts Fahrenheit to Celsius"
print "Type in a temperature in Fahrenheir:",
fahrenheir=float(raw_input())#使用float(raw_input())从用户得到温度(华氏)
celsius=(fahrenheir-32)*5.0/9
print "That is",celsius,"degrees Celsius"
运行结果:
>>> ================================ RESTART ================================
>>>
This program converts Fahrenheit to Celsius
Type in a temperature in Fahrenheir: 89
That is 31.6666666667 degrees Celsius
>>>
其实input()函数也能实现。但是Python的将来版本(3.0及以后版本)去除了input()函数,只会有raw_input()。。。