Open study

is now brainly

With Brainly you can:

  • Get homework help from millions of students and moderators
  • Learn how to solve problems with step-by-step explanations
  • Share your knowledge and earn points by helping other students
  • Learn anywhere, anytime with the Brainly app!

A community for students.

Hi fellow OCW students, I have a question about problem 2 on problem set 9 of 6.00 intro to computer science and programming. 1) I have no idea what I should do for def__iter__(self) part. I think I don't know what the iterator does in a class or sth. 2) http://paste.bradleygill.com/index.php?paste_id=3786 I get a error message after spitting out the right result as follows: Traceback (most recent call last): File "", line 1, in str(pj) TypeError: __str__ returned non-string (type NoneType) What did I do wrong here?

Computer Science
I got my questions answered at brainly.com in under 10 minutes. Go to brainly.com now for free help!
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

1) I don't know that mutch about the __iter__ method. You could try to see if you understand http://docs.python.org/2/library/stdtypes.html#iterator-types 2) The __str__ method expects you to return a string as the result of the method. You don't return anything, but you print directly. Try writing all the strings you now print into a variable. At the end of the method, you can return that variable. You shouldn't need to print anything yourself.

Not the answer you are looking for?

Search for more explanations.

Ask your own question

Other answers:

Not the answer you are looking for?

Search for more explanations.

Ask your own question