NZEC error in Python

前端 未结 5 1975
自闭症患者
自闭症患者 2021-01-13 13:31

this is a simple piece of code which is suppose to read n numbers and suppose to print how many numbers out of these n numbers are divisible by k

n=int(raw_i         


        
5条回答
  •  情歌与酒
    2021-01-13 13:56

    PUT TRY AND EXCEPT I DID THIS IN MY CODECHEF CODE AND IT'S WORKS

    try: 
        n , k = map(int , input().split())
        ans=0
        while n > 0:
            t=int(input())
            if(t%k == 0):
                ans = ans + 1
            n = n - 1
            print(ans) 
    except:
        pass
    

提交回复
热议问题