Skip to content

Instantly share code, notes, and snippets.

@rennerocha
Created January 11, 2013 13:47
Show Gist options
  • Save rennerocha/4510784 to your computer and use it in GitHub Desktop.
Save rennerocha/4510784 to your computer and use it in GitHub Desktop.
import string
def holes(letter):
holes_input = string.ascii_letters
holes_output = "1101101000000011100000000012010000000000111100000000"
holes_table = maketrans(holes_input, holes_output)
return int(letter.translate(holes_table))
def count_holes(text):
text = text.replace(' ', '') # Ignore spaces
return sum([holes(letter) for letter in text])
if __name__ == '__main__':
input = 'paralelepipedo'
print count_holes(input)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment