# Argument checker #if len(sys.argv) <= 1: # print("Argument required") # break #input string and string validity checker here inputText = "ironbrigade" # test input #Single character leet speak dictionary leetDict = { "a" : ["a","A","@","4","^"], "b" : ["b","B","6"], "c" : ["c","C","("], "d" : ["d","D"], "e" : ["e","E","3"], "f" : ["f","F"], "g" : ["g","G","9","6"], "h" : ["h","H","#"], "i" : ["i","I","1","!"], "j" : ["j","J"], "k" : ["k","K"], "l" : ["l","L","1"], "m" : ["m","M"], "n" : ["n","N"], "o" : ["o","O","0"], "p" : ["p","P"], "q" : ["q","Q"], "r" : ["r","R"], "s" : ["s","S","5","$"], "t" : ["t","T","7"], "u" : ["u","U"], "v" : ["v","V"], "w" : ["w","W"], "x" : ["x","X"], "y" : ["y","Y"], "z" : ["z","Z","2"] } #Loop creating a string representing the number possible leet character replacments # that will be used to determine the max number in calculating all possible character combinations dataLengths = "" for letter in inputText: dataLengths = dataLengths + str(len(leetDict[letter]) - 1) lengthsInt = int(dataLengths) #change top value to integer for use in loop below counter = 0 while counter < lengthsInt: additive = 0 for countLength in range(len(dataLengths)): backNumb = (countLength + 1) * (-1) currentPlace = int(dataLengths[backNumb:]) countPlace = int (str(counter)[backNumb:]) if countPlace == currentPlace: additive = 10**(countLength + 1) - countPlace if additive == 0: additive += 1 counter = counter + additive strCounter = str(counter) while len(strCounter) < len(dataLengths): strCounter = "0" + strCounter print(strCounter) combos = "" for comboNumb in range(len(strCounter)): combos = combos + leetDict[inputText[comboNumb]][int(strCounter[comboNumb])] print(combos)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question