我正在运行下面的代码,并得到结果未定义的错误
inp = input("Enter the value to convert = ")
degree = int(inp[:-1])
i_conversion = inp[-1]
if i_conversion.upper == "C":
result = int(round((9 * degree) / 5 + 32))
o_conversion = "Fahrenheit"
elif i_conversion.upper == "F":
result = int(round((degree - 32) * 5 / 9))
o_conversion = "Celsius"
print("The temp is", result)
str.upper
是函数而不是属性;它后面需要括号Docs相关问题 更多 >
编程相关推荐