Ace school

with brainly

  • Get help from millions of students
  • Learn from experts with step-by-step explanations
  • Level-up by helping others

A community for students.

Question about why these functions return certain values. Thanks in advance. http://pastebin.com/k5wfxp33

MIT 6.00 Intro Computer Science (OCW)
See more answers at brainly.com
At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.

Join Brainly to access

this expert answer

SEE EXPERT ANSWER

To see the expert answer you'll need to create a free account at Brainly

It is a process similar to the toString() method in Java, when you print an object you are basically getting a printout of its member variables rather than an execution of the object. Take a look at object.__str__(self) in the Python documentation for a more detailed explanation.
To expand on what @eSpeX said, look carefully at your definition of zoo(). What does it return? Answer: nothing. A function needs a return statement to return an object. When zoo() is called, another call is made to monkey(), which returns 5 INTO THE FUNCTION zoo(), not as a result of the function. To get the result I assume you are looking for (having zoo() return 5), you need to replace line 5 with "return monkey()". Do you see what would happen if you just wrote "return monkey" with no parens containing arguments?
|dw:1353472341103:dw| Does this help clear things up?

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Just as jgoldsmith explained, The problem is that Zoo function doesn't use the keywork 'return' to archive the expected behavior.
Thanks everyone. I appreciate the answers. I understand now.

Not the answer you are looking for?

Search for more explanations.

Ask your own question