On Wed, 2012-05-30 at 12:21 -0400, Akeria Timothy wrote:
[...]
> def joinStrings(stringList):
>  string = []

indentation error in that the above line and the below line should have
the same indent level.  Also the above line and the following line are
both definitions of the variable string so the above is actually
redundant.

>     for string in stringList:
>         print ''.join(stringList)

Given the variable doesn't appear in the block I wonder if the code
reflects the intended algorithm?

> 
> def main():
>     print joinStrings(['very', 'hot', 'day'])
>     print joinStrings(['this', 'is', 'it'])
>     print joinStrings(['1', '2', '3', '4', '5'])
> 
> main()

The above code, with the trivial indent fix, outputs:

        veryhotday
        veryhotday
        veryhotday
        None
        thisisit
        thisisit
        thisisit
        None
        12345
        12345
        12345
        12345
        12345
        None

Is this what was desired?  I am tempted to think that actually what was
desired was:

        veryhotday
        thisisit
        12345

in which case I would suggest the code should perhaps read:

        def main():
            print ''.join(['very', 'hot', 'day'])
            print ''.join(['this', 'is', 'it'])
            print ''.join(['1', '2', '3', '4', '5'])
        
        if __name__ == '__main__':
            main()

but, mayhap, I am missing the intention.

-- 
Russel.
=============================================================================
Dr Russel Winder      t: +44 20 7585 2200   voip: sip:russel.win...@ekiga.net
41 Buckmaster Road    m: +44 7770 465 077   xmpp: rus...@winder.org.uk
London SW11 1EN, UK   w: www.russel.org.uk  skype: russel_winder

Attachment: signature.asc
Description: This is a digitally signed message part

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to