[tutor] functions and classes

Dan Dud wheelcrdan@hotmail.com
Wed Oct 23 11:53:03 2002


Hi everyone

Hope everyone is doing great. I wrote some functions that looked confusing 
and I tried to define everything before but I think I have it right now,,, 
How do these look??? I took the idea out of chapter 4 how to think like a 
computer scientest chapter 4

def compare(x,y): # this is what I think the compare should look like
    if x < y:
        print x, "is less then", y
    elif x > y:
        print x, "is greater then", y
    else:
        print x, "and", y, "are equal"


here is the second one

def disbatch(choice): # this is what I think the disbatch should look like
    if choice == 'A':
        functionA()
    elif choice == 'B':
        functionB()
    elif choice == 'C':
        functionC()
    else:
        print "Invlaid choice"


the next question is When I define a class do I import these then use them 
by calling them then define the class or do I do that afterwards
thanks for the everyone help

Danny D


_________________________________________________________________
Choose an Internet access plan right for you -- try MSN! 
http://resourcecenter.msn.com/access/plans/default.asp