Last active
December 11, 2015 14:38
-
-
Save YoSmudge/4614955 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import re | |
class CapsTalk(object): | |
def __init__(self): | |
self.parseInput() | |
def parseInput(self): | |
counter = 0 | |
while True: | |
ip = raw_input('> ') | |
out = "" | |
ip = re.sub(r'[^a-zA-Z0-9]', '', ip) | |
for i in range(0,len(ip)): | |
if counter%2 == 0: | |
out += ip[i].lower() | |
else: | |
out += ip[i].upper() | |
counter += 1 | |
print out | |
#If counter is even it can be reset | |
if counter%2 == 0: | |
counter = 0 | |
if __name__ == '__main__': | |
CapsTalk() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment