count = 0 for i in range(1, 1001): if '4' in str(i): count += 1 count -= 1 print(count)