Python中文
首页
教程
问答
标签
搜索
登录
注册
TypeError:不支持+的操作数类型:“int”和“str”如何修复
回答此问题可获得
20
贡献值,回答如果被采纳可获得
50
分。
<pre><code>a = 1 s = 0 print ('Enter Numbers to add to the sum') print ('enter 0 to quit') while a != 0: print ('Current Sum',s) a = input('Number?: ') s = s + a print ('Total sum: ',s) </code></pre> <p>如何修正这个错误?在</p>
0 条评论
分类:
Python问答
请先
登录
后评论
默认排序
时间排序
1 个回答
匿名
1天前
擅长:python、mysql、java
<p>你必须把输入的字符串转换成数字。例如:</p> <pre><code> a = int(input('Number?: ')) </code></pre> <p>其他新闻:</p> <p>您可以使用short-cut<strong>+=</strong>运算符求和<strong>s</strong>:</p> ^{pr2}$
请先
登录
后评论
针对此问题:
更多的回答
关注
89
关注
收藏
1
收藏,
216
浏览
网友 提问于 2天前
相关Python问题
Python中的顺序遍历
9 回答
Python中的顺序随机选择
6 回答
python中的预处理
10 回答
Python中的预处理器ifdefine
7 回答
python中的预条件共轭梯度与线性化器
10 回答
Python中的预测值
6 回答
python中的预测期权看涨期权FFT方法
4 回答
Python中的预测模型
2 回答
Python中的预测模型、目标函数和优化
6 回答
Python中的预计算对象
3 回答
python中的频带通?
6 回答
Python中的频率
8 回答
python中的频率与总计数条形图
1 回答
Python中的频率分析
1 回答
Python中的频率分析以频率打印字母,而不是按频率打印数字
9 回答
python中的频率分析程序
3 回答
python中的频率绘制
5 回答
python中的频率表
2 回答
Python中的频移键控
10 回答
Python中的频繁模式挖掘
10 回答