【发布时间】:2015-03-10 23:09:05
【问题描述】:
我刚刚开始从一本书中学习 Python。但是当我运行我的脚本时,我一直遇到同样的问题,它说:
File "C:/Users/bob/Desktop/Python/Part3 A.py", line 8, in <module> print(' the average is: ', avg())
File "C:/Users/Bob/Desktop/Python/Part3 A.py", line 6, in avg average = a + b + c / 3
TypeError: unsupported operand type(s) for /: 'str' and 'int'
我是不是安装错了“Pycharm”?
这是我的代码
def avg():
a = input('please enter a: ')
b = input('please enter b: ')
c = input('please enter c: ')
average = a + b + c / 3
print(' the average is: ', avg())
【问题讨论】:
标签: python python-2.7 python-3.x installation average