fork download
  1. #TempConvert.py
  2. TempStr = input("请输入带有符号的温度值: ")
  3. if TempStr[-1] in ['F', 'f']:
  4. C = (eval(TempStr[0:-1]) - 32)/1.8
  5. print("转换后的温度是{:.2f}C".format(C))
  6. elif TempStr[-1] in ['C', 'c']:
  7. F = 1.8*eval(TempStr[0:-1]) + 32
  8. print("转换后的温度是{:.2f}F".format(F))
  9. else:
  10. print("输入格式错误")
  11.  
Runtime error #stdin #stdout #stderr 0.16s 23476KB
stdin
Standard input is empty
stdout
请输入带有符号的温度值: 
stderr
Traceback (most recent call last):
  File "./prog.py", line 2, in <module>
EOFError: EOF when reading a line