[Tutor] Python Question
Danny Yoo
dyoo at hashcollision.org
Sat Jan 11 04:44:45 CET 2014
On Fri, Jan 10, 2014 at 5:57 PM, Amy Davidson <amydavidson at sympatico.ca> wrote:
> Hey Danny,
>
> I just started taking the course (introduction to Computer Science) on last Tuesday, so I am not to familiar. I have been doing my best to understand the material by reading the text book, Learn Python the hard way.
>
> In my quest to answer the question given to me, I have searched the internet high and low of other functions thus, I am familiar with the basic knowledge of them (i.e. starting with def) as well as examples.
Great, ok. So you're going through Learn Python the Hard Way.
I'm looking at the beginning of:
http://learnpythonthehardway.org/book/ex19.html
Have you gotten that far yet? I see a function at the beginning of
that section called cheese_and_crackers.
######################################################
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"
######################################################
Can you tell me a little bit of how this function definition works?
What is the "%d" thing there? What is cheese_count, and what is
box_of_crackers?
Have you been able to effectively type in this function and use it in
your Python programming environment?
Are there any similarities between what this function definition does,
and what your problem statement asks?
More information about the Tutor
mailing list