CheckIO: Roman numerals

import collections import functools Symbols = collections.namedtuple( ‘Symbols’, [‘unus’, ‘quinque’, ‘decem’, ‘quinquaginta’, ‘centum’, ‘quingenti’, ‘mille’] ) symbol = Symbols(‘I’, ‘V’, ‘X’, ‘L’, ‘C’, ‘D’, ‘M’) def to_roman(digit, one, five, ten): if 0 < digit < 4: return ”.join([one for _…

CheckIO: Pawn Brotherhood

import itertools def safe_pawns(pawns): safe_squares = itertools.chain(*[calc_safe_squares(p) for p in pawns]) return len(pawns & set(safe_squares)) def calc_safe_squares(pos): return (chr(ord(pos[0]) – 1) + str(int(pos[1]) + 1), chr(ord(pos[0]) + 1) + str(int(pos[1]) + 1)) if __name__ == ‘__main__’: #These “asserts” using only…

CheckIO: Speech Module

FIRST_TEN = [“one”, “two”, “three”, “four”, “five”, “six”, “seven”, “eight”, “nine”] SECOND_TEN = [“ten”, “eleven”, “twelve”, “thirteen”, “fourteen”, “fifteen”, “sixteen”, “seventeen”, “eighteen”, “nineteen”] OTHER_TENS = [“twenty”, “thirty”, “forty”, “fifty”, “sixty”, “seventy”, “eighty”, “ninety”] HUNDRED = “hundred” def checkio(number): second_tens =…