Skip to content

Instantly share code, notes, and snippets.

@sneg55
Last active August 2, 2016 23:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sneg55/315a9d7fbb139f6023a4c5acaae4a96a to your computer and use it in GitHub Desktop.
Save sneg55/315a9d7fbb139f6023a4c5acaae4a96a to your computer and use it in GitHub Desktop.
#let's count the number of possible combinations
import string
#domain names can consist of letters, numbers plus dash https://en.wikipedia.org/wiki/Punycode
chars = list(string.lowercase + string.digits + '-')
#count che number of possible symbols
tt = len(chars)
from collections import defaultdict
maxcombinations = defaultdict(int)
for i in range (1,15):
maxcombinations[i] = (tt ** i)
for length, count in maxcombinations.items():
#let's print the pyramid what we got (I decide to stop at 14 symbols)
print "Number of symbols ", length, ", combinations :", count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment