예제로 간단하게 살펴볼게요 1~50의 숫자가 들어간 list에서 1의 개수 세기 answer = 0 for i in range(1, 51): answer += str(i).count('1') print(answer)