Python Module: nift

J seaworthyjeremy at gmail.com
Sun Feb 8 19:42:02 CET 2009


What are your thoughts on this module I created?

'''
    A Python Module created by a High School Student.
           Includes rev(), reet(), and leet().

                    Import nift

    Function:       nift.rev()
    Description:    Reverses a string
    Usage:          nift.rev('string')
    Example:        nift.rev('Testing function.')
    Output:         '.noitcnuf gnitseT'

    Function:       nift.reet()
    Description:    Reverses a string
                    and transforms to leet text.
    Usage:          nift.reet('string')
    Example:        nift.reet('Hello World!')
    Output:         'dlr0W 0ll3H'

    Function:       nift.leet()
    Description:    Transforms a string
                    into leet text.
    Usage:          nift.leet('string')
    Example:        nift.leet('Hello there!')
    Output:         'H3ll0 7h3r3!'

    Setup:
                    * Save to Python Directory\Lib\ as nift.py
                    * Now you may import it by:
                        from nift import function
                        function()
                                    OR
                        import nift
                        nift.function()

    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
    * This Module and its functions were created for my own fun, also
*
    * contributing to Inter-Society. I don't mind if anyone modifies
*
    *  this module or adds on to it, as long as you attribute it to
*
    *                           Myself.
*
    * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
*
'''

def rev(string):
    list = []
    final = ''
    for letters in string:
        list.append(letters)
    list.reverse()
    for letters in list:
        final = final + letters
    return final

def reet(string):
    list = []
    final = ''
    for letters in string:
        list.append(letters)
    list.reverse()
    for letters in list:
        if letters == 'e' or letters == 'E':
            letters = '3'
        elif letters == 'a' or letters == 'A':
            letters = '4'
        elif letters == 'i' or letters == 'I':
            letters = '1'
        elif letters == 't' or letters == 'T':
            letters = '7'
        elif letters == 's' or letters == 'S':
            letters = '5'
        elif letters == 'o' or letters == 'O':
            letters = '0'
        elif letters == 'b' or letters == 'B':
            letters = '8'
        final = final + letters
    return final

def leet(string):
    list = []
    final = ''
    for letters in string:
        if letters == 'e' or letters == 'E':
            letters = '3'
        elif letters == 'a' or letters == 'A':
            letters = '4'
        elif letters == 'i' or letters == 'I':
            letters = '1'
        elif letters == 't' or letters == 'T':
            letters = '7'
        elif letters == 's' or letters == 'S':
            letters = '5'
        elif letters == 'o' or letters == 'O':
            letters = '0'
        elif letters == 'b' or letters == 'B':
            letters = '8'
        list.append(letters)
    for letters in list:
        final = final + letters
    return final



More information about the Python-list mailing list