Skip to content

Instantly share code, notes, and snippets.

@santhalakshminarayana
Last active December 13, 2019 05:55
Show Gist options
  • Select an option

  • Save santhalakshminarayana/0f06823f76bec676b2bfde562dd99f4e to your computer and use it in GitHub Desktop.

Select an option

Save santhalakshminarayana/0f06823f76bec676b2bfde562dd99f4e to your computer and use it in GitHub Desktop.
Indian Name Generator - Group names and unique chars - Medium
group_names = []
for name in names:
name_list = name.split(' ')
group_names.extend(name_list)
group_names = set(group_names)
unique_chars=set()
names = []
for name in group_names:
names.append(name+'.')
unique_chars = unique_chars.union(set(name))
print(unique_chars)
char_to_int = dict([(chr(i+65),i) for i in range(26)])
int_to_char = dict([(i,chr(i+65)) for i in range(26)])
char_to_int['.'] = len(char_to_int)+1
int_to_char[len(int_to_char)+1] = '.'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment