【问题标题】:ValueError:invalid literal for int() with base 10:1,2ValueError:int() 的无效文字,基数为 10:1,2
【发布时间】:2022-06-17 00:10:55
【问题描述】:

我收到此错误 ValueError: invalid literal for int() with base 10: when o enter any value。请检查我的代码哪里出错了。我最近开始使用python,所以如果可能,请指出代码中是否存在任何其他错误。

 total = 0
print('This program helps you calculate the sum and mean of the enter numbers. ')
x = (int(input('Please enter the numbers you want to apply the functions to : ')))
for number in [x] :
    total = total + number
y = x.count()   
mean = total / x
print('Total : ' , total)
print('Mean : ' , mean) 

【问题讨论】:

  • 你对int("1,2")有什么期望?

标签: python


猜你喜欢
  • 2021-08-06
  • 2018-09-05
  • 2021-12-18
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2018-01-20
  • 2017-12-16
  • 1970-01-01
相关资源
最近更新 更多