小编Abh*_*hek的帖子

Python 3错误:ValueError:基数为10的int()的无效文字:''

我已经编写了代码来解决问题.

这是我的代码:

t=int(input())
print("")
while(t):
    s=0
    n=int(input())
    for i in range(n):
        no=int(input())
        s=s+no
    if s%n==0:
        print("YES")
    else:
        print("NO")
    print("")
    t-=1
Run Code Online (Sandbox Code Playgroud)

当我在OS X终端上运行它时,它工作正常.但是当我运行它IDEone或将其作为解决方案提交时,它会给出错误line 5:

ValueError:基数为10的int()的无效文字:''

我不确定问题是什么.

python python-3.x

1
推荐指数
1
解决办法
914
查看次数

为什么我的if语句不起作用

我的代码是

#include <stdio.h>
int main()
{
    int n;
    unsigned long int a,x;
    scanf("%d",&n);
    while(n--)
    {
        scanf("%lu",&a);
        int count=0;
        while(a!=0)
        {
            x=a%10;
            printf("x=%lu\n",x );
            if(x!=4||x!=7)
            {
                count++;
            }
            printf("count =%d\n",count );
            a=a/10;
        }
        //printf("%d\n",count );
    }
}
Run Code Online (Sandbox Code Playgroud)

我观察到当x = 4或x = 7计数增加时,它不应该因为我在其中放入了if条件.

c numbers

-3
推荐指数
1
解决办法
80
查看次数

标签 统计

c ×1

numbers ×1

python ×1

python-3.x ×1