loading...

Discussion on: Daily Challenge #272 - Printer Errors

Collapse
boris profile image
Boris Quiroz

Python

import string

def print_error(s):
    chars = string.ascii_lowercase
    good = list(chars)[chars.find('a'):chars.find('m')+1]
    count = 0

    for c in s:
        if c not in good:
            count += 1

    print("{}/{}".format(count, len(s)))


print_error("aaabbbbhaijjjm")
print_error("aaaxbbbbyyhwawiwjjjwwm")
print_error("aaaaaaaaaaaaaaaabbbbbbbbbbbbbbbbbbmmmmmmmmmmmmmmmmmmmxyz")
print_error("aaabbbbbbccccccddddddeee")
print_error("verylargepiggoesoink")