|
马上注册,结交更多好友,享用更多功能^_^
您需要 登录 才可以下载或查看,没有账号?立即注册
x
def temp_conversion():
f = c * 1.8 + 32
return f
c = float(input("请输入摄氏度:"))
f = temp_conversion(c)
print("转化为华氏度是" + str(f))
请输入摄氏度:37.3
Traceback (most recent call last):
File "C:\Users\Administrator\Desktop\python\temp.py", line 5, in <module>
f = temp_conversion(c)
TypeError: temp_conversion() takes 0 positional arguments but 1 was given
- def temp_conversion(c): #这里少了个形参c
- f = c * 1.8 + 32
- return f
-
- c = float(input("请输入摄氏度:"))
- f = temp_conversion(c)
- print("转化为华氏度是" + str(f))
复制代码
少了个形参c
|
|