【发布时间】:2020-01-23 14:42:07
【问题描述】:
我刚接触 python,正在尝试学习这种语言。我尝试在 python 中运行代码但出现错误任何人都可以帮助我 这是我的代码:
def cel_to_fahr(c):
f = c * 9/5 + 32
return f
c = input("enter the temperature in celcius:")
print(cel_to_fahr(c))
我得到的错误是:
File ".\prg.py", line 6, in <module>
print(cel_to_fahr(c))
File ".\prg.py", line 2, in cel_to_fahr
f = c * 9/5 + 32
TypeError: unsupported operand type(s) for /: 'str' and 'int
'
【问题讨论】:
标签: python python-3.x