DEV Community

loading...

Discussion on: Coding Puzzles: Week of 4/8

Collapse
aspittel profile image
Ali Spittel Author
n_cases = int(input())
for i in range(1, n_cases + 1):
    check_amount = int(input())
    unfound = True
    fours = [int(i) for i in str(check_amount)]
    others = ["1" if n == 4 else "0" for n in fours]
    n = int(''.join(others))
    print("Case #{}: {} {}".format(i, n, check_amount - n))