On 12 Feb 2012 00:29, "amt" <0101...@gmail.com> wrote: > > Hello! I'm currently stuck at the Extra Credit 3 from LPTHW. > > Link to the actual exercise: http://learnpythonthehardway.org/book/ex19.html > The exercise: > Write at least one more function of your own design, and run it 10 > different ways. > > > Code from the book: > def cheese_and_crackers(cheese_count, boxes_of_crackers): > print "You have %d cheeses!" % cheese_count > print "You have %d boxes of crackers!" % boxes_of_crackers > print "Man that's enough for a party!" > print "Get a blanket.\n" > > > print "We can just give the function numbers directly:" > cheese_and_crackers(20, 30)
> I wrote a function similar to cheese_and_crackers and it works just > fine but I can't figure out more ways of calling a function other than > the ones presented in the code(with integers as arguments,variables as > arguments, two integer additions as arguments and with arguments in > the form of variable+integer). The author states that there are 10 > different ways to run it.(in a comment he states that: "You can run it > a lot of different ways, far too many to enumerate.). > > > So, what other ways are there aside the ones already presented in the > above code? > > Hi, Subject to the same caveats as your other replies: How about for (cheesecount, crackercount) in [(3,5), (7,42)]: cheese_and_crackers(cheesecount, crackercount) Best, Brian vdB
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor