[Tutor] still not getting 'it'

Rosalee Dubberly dubberlyr at msn.com
Thu Oct 6 00:15:00 CEST 2005


I am having problems with changing the parameters in my second function. I 
want the second function to run the same as the first, but take different
parameters. What am I doing wrong????

def firstpart():
   """Define a function that takes no parameters and does the following:
       Returns (not prints) a list of 512 items, each consisting of the 
string, 'passed',
       unless the index of the item is a multiple of 3, 7, or 11,
       in which case the string for that index is 'tryagain'"""
   for n in range( 0, 55 ):
       if n % 3 == 0 or n % 7 == 0 or n % 11 == 0:
    print 'passed,',
       else:
    print 'tryagain,',
   return firstpart




def changes(passed=success,  tryagain=fail):
    """Define a second function that acts in the same way as the first 
function,
       except that it takes parameters whose values replace 'passed' and 
'tryagain' in the first function."""

    for n in range ( 0, 55 ):
        if n % 3 == 0 or n % 7 == 0 or n % 11 == 0:
            print ' passed,',
        else:
            print 'tryagain,',

        alist.append(['success', 'fail'])
    return alist

thelist = changes('success', 'fail')

_________________________________________________________________
Express yourself instantly with MSN Messenger! Download today - it's FREE! 
http://messenger.msn.click-url.com/go/onm00200471ave/direct/01/



More information about the Tutor mailing list