Skip to content

Instantly share code, notes, and snippets.

@YoSmudge
Last active December 11, 2015 14:38

Revisions

  1. Sam Rudge revised this gist Jan 23, 2013. 1 changed file with 9 additions and 1 deletion.
    10 changes: 9 additions & 1 deletion gistfile1.py
    Original file line number Diff line number Diff line change
    @@ -5,6 +5,8 @@ def __init__(self):
    self.parseInput()

    def parseInput(self):
    counter = 0

    while True:
    ip = raw_input('> ')

    @@ -13,12 +15,18 @@ def parseInput(self):
    ip = re.sub(r'[^a-zA-Z0-9]', '', ip)

    for i in range(0,len(ip)):
    if i%2 == 0:
    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()
  2. Sam Rudge revised this gist Jan 23, 2013. 1 changed file with 19 additions and 19 deletions.
    38 changes: 19 additions & 19 deletions gistfile1.py
    Original file line number Diff line number Diff line change
    @@ -1,24 +1,24 @@
    import re

    class CapsTalk(object):
    def __init__(self):
    self.parseInput()
    def parseInput(self):
    while True:
    ip = raw_input('> ')
    out = ""
    ip = re.sub(r'[^a-zA-Z0-9]', '', ip)
    for i in range(0,len(ip)):
    if i%2 == 0:
    out += ip[i].lower()
    else:
    out += ip[i].upper()
    print out
    def __init__(self):
    self.parseInput()
    def parseInput(self):
    while True:
    ip = raw_input('> ')
    out = ""
    ip = re.sub(r'[^a-zA-Z0-9]', '', ip)
    for i in range(0,len(ip)):
    if i%2 == 0:
    out += ip[i].lower()
    else:
    out += ip[i].upper()
    print out

    if __name__ == '__main__':
    CapsTalk()
    CapsTalk()
  3. Sam Rudge created this gist Jan 23, 2013.
    24 changes: 24 additions & 0 deletions gistfile1.py
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,24 @@
    import re

    class CapsTalk(object):
    def __init__(self):
    self.parseInput()

    def parseInput(self):
    while True:
    ip = raw_input('> ')

    out = ""

    ip = re.sub(r'[^a-zA-Z0-9]', '', ip)

    for i in range(0,len(ip)):
    if i%2 == 0:
    out += ip[i].lower()
    else:
    out += ip[i].upper()

    print out

    if __name__ == '__main__':
    CapsTalk()