anonymous
  • anonymous
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
jamiebookeater
  • jamiebookeater
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.

Get this expert

answer on brainly

SEE EXPERT ANSWER

Get your free account and access expert answers to this
and thousands of other questions

anonymous
  • anonymous
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.

Looking for something else?

Not the answer you are looking for? Search for more explanations.