Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import random
- def toLowercaseStr (msg):
- temp = '' #template
- for c in msg:
- c = toLowercaseChar(c)
- temp += c
- return temp
- def toIntVal (c):
- c = (str)(c)
- return ord(c)
- def toLowercaseChar(c):
- START = 'A' #range of characters to be checked is from capital A-Z
- END = 'Z'
- charIntVal = toIntVal(c)
- startIntVal = toIntVal(START)
- endIntVal = toIntVal(END)
- if startIntVal <= charIntVal <= endIntVal:
- charIntVal -= toIntVal('A') - toIntVal('a')
- c = intValToChar(charIntVal)
- return c
- def intValToChar (n):
- n = (int)(n)
- return chr(n)
- def convertStrToJeje (s):
- temp = ''
- for c in s:
- c = (str)(c)
- temp += convertCharToJeje(c)
- return temp
- def convertCharToJeje(c):
- c = toLowercaseChar(c)
- temp = c
- if c == 'a':
- temp = getRandomElementFromList(['a','A','@','4'])
- elif c == 'b':
- temp = getRandomElementFromList(['b','B','|3'])
- elif c == 'c':
- temp = getRandomElementFromList(['c','C','(','<','{'])
- elif c == 'd':
- temp = getRandomElementFromList(['d','D','|)','|>'])
- elif c == 'e':
- temp = getRandomElementFromList(['e','E','3'])
- elif c == 'f':
- temp = getRandomElementFromList(['f','F'])
- elif c == 'g':
- temp = getRandomElementFromList(['g','G','6'])
- elif c == 'h':
- temp = getRandomElementFromList(['h','H','|-|','#'])
- elif c == 'i':
- temp = getRandomElementFromList(['i','I','!'])
- elif c == 'j':
- temp = getRandomElementFromList(['j','J'])
- elif c == 'k':
- temp = getRandomElementFromList(['k','K','|<'])
- elif c == 'l':
- temp = getRandomElementFromList(['l','L','1'])
- elif c == 'm':
- temp = getRandomElementFromList(['m','M'])
- elif c == 'n':
- temp = getRandomElementFromList(['n','N'])
- elif c == 'o':
- temp = getRandomElementFromList(['o','O','0'])
- elif c == 'p':
- temp = getRandomElementFromList(['p','P'])
- elif c == 'q':
- temp = getRandomElementFromList(['q','Q','9'])
- elif c == 'r':
- temp = getRandomElementFromList(['r','R',"|2"])
- elif c == 's':
- temp = getRandomElementFromList(['s','S','5'])
- elif c == 't':
- temp = getRandomElementFromList(['t','T','+'])
- elif c == 'u':
- temp = getRandomElementFromList(['u','U','|_|'])
- elif c == 'v':
- temp = getRandomElementFromList(['v','V','\\/'])
- elif c == 'w':
- temp = getRandomElementFromList(['w','W'])
- elif c == 'x':
- temp = getRandomElementFromList(['x','X'])
- elif c == 'y':
- temp = getRandomElementFromList(['y','Y'])
- elif c == 'z':
- temp = getRandomElementFromList(['z','Z'])
- return temp
- def getRandomElementFromList(ls):
- return random.choice(ls)
- s = ''
- s = raw_input('Enter a string:\n')
- print 'Jejemon Conversion:\n',convertStrToJeje(s)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement