--我的目标是制作一个代码,用户必须输入温度,然后用户必须输入单位(C或F),然后我想显示转换为F,如果用户输入C,反之亦然。这里出了什么问题请告诉我,我对python非常陌生,整天都在学习,谢谢。
print("Lets convert from C to F/ F to C")
temp = int(input("enter the temperature: "))
unit = input("enter the unit (C or F)")
if unit == C:
F = temp * 1.8 + 32
print(temp +"C is equal to"+F +"F")
elif unit == F:
C = temp / 1.8 - 32
print(temp + "F is equal to" +C + "C")