我是 Python 新手,如果要将华氏温度转换为摄氏温度,我正在尝试制作一个 Python 程序。这是程序:
x = (raw_input("would you like to convert fahrenheit(f) or celsius(c)?"))
if x == "f":
y = (raw_input("what is the fahrenheit?"))
f = (int(y) - 32) * 5.0 / 9
print f
if x == "c":
n = (raw_input("what is the celsius?"))
z = (int(n) *9) / 5 + 32
print "and in fahrenheit, that is:"
print z
我试图更改if x == "c"
为elif x == "c"
,但它给了我一个TextError
. 有任何想法吗?