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)


print "OR, we can use variables from our script:"
amount_of_cheese = 10
amount_of_crackers = 50

cheese_and_crackers(amount_of_cheese, amount_of_crackers)


print "We can even do math inside too:"
cheese_and_crackers(10 + 20, 5 + 6)


print "And we can combine the two, variables and math:"
cheese_and_crackers(amount_of_cheese + 100, amount_of_crackers + 1000)





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?



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

Reply via email to