[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,',
    print 'tryagain,',
   return firstpart

def changes(passed=success,  tryagain=fail):
    """Define a second function that acts in the same way as the first 
       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,',
            print 'tryagain,',

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

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

Express yourself instantly with MSN Messenger! Download today - it's FREE! 

More information about the Tutor mailing list