Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Clear category for Champernowne Word by mortonfox
def gen():
i = 1
while True:
for c in str(i): yield int(c)
i += 1
from itertools import islice
def counting_series(n: int) -> int:
return next(islice(gen(), n, None))
print("Example:")
print(counting_series(1))
# These "asserts" are used for self-checking
assert counting_series(0) == 1
assert counting_series(10) == 0
assert counting_series(100) == 5
print("The mission is done! Click 'Check Solution' to earn rewards!")
Dec. 14, 2023