Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon. Entire thread

Add to this code.

Name: Anonymous 2009-03-29 3:03

Here's how this works: I post some starter code and you post code that extends it and adds functionality in some way. No trolling, dammit.

=============================================================

#!/usr/bin/python

# I'm using Fedora 9

# list of commands available to the user (add commands here
comm_list = [\
"exit",\
"help",\
"!?"
]

def print_help ():
        """
        print a list of available commands and what they do
        """
        print ('"exit"                  = exit the program')
        print ('"help" or "!?"          = print this help message')
        return
   
def cli_main ():
        """
        this function implements the program using a command line interface
        """
        command = ''

        while command != comm_list [0]:#exit
            command = raw_input (":> ")
            if command == comm_list [0]: # exit
                print ("Terminating...")
            elif command == comm_list [1] or command == comm_list [2]: # !? or help
                print_help ()
                        # elif command == comm_list [n]:
                        #       do stuff
                        # etc.
            else:
                print ("I don't know what you mean; try typing something I understand.")
                print ("Type \"!?\" or \"" + self.comm_list [2] + "\" for help.")
        return 0
cli_main ()

Name: Anonymous 2009-03-29 4:12

>>8
Maybe you should. But he'd probably tell you to fuck off like the faggot you are.

Newer Posts
Don't change these.
Name: Email:
Entire Thread Thread List