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.
I THINK it's because you're only telling it to append the last solution. If you want to append early in the looping loops, you'll have to unindent. The append commend belongs to the last loop, only, because it is intended after it. I have barely just completed ps1b, so haven't gotten to this ps2* at all, but that's my guess.
commAnd (not commend...can't type today)
tonybaldwin, you're right. OMG- I figured this out about 10 minutes after I shut down my computer. I'll leave this question up just to make everyone else feel really smart. STUPID question. Hopefully this question is slightly less stupid: I'm wondering if it's possible to print things NOT in a list. For example: >>> mylist = [1, 3, 5] >>> mylist.NotThere in range (1, 6) ## and Python would know what the heck I'm talking about and return: [2, 4] Is that possible?
it is possible. python has a data type that you haven't been introduced to that makes it easy. http://docs.python.org/library/stdtypes.html#set-types-set-frozenset the difference method does what you want. here are some examples: http://codepad.org/JjnYoyVU without using sets - http://codepad.org/M1ExloXK
I think it isn't possible when element are in the list. Look at this http://docs.python.org/tutorial/datastructures.html There is no method for doing that. I have done it this way: http://codepad.org/Sz1yhg2m
Thank you guys! I'll tinker around with your suggestions.
2 questions about the above: 1) aren't you supposed to iterate beginning with n = 1? 2) there has to be a way to write the code using only the things learned in the preceding lectures, right?
there are readings associated with the lectures also. and the actual course at the institute has 'study sessions' outside of lecture with TA's/grad students - that we don't get at ocw. I can't imagine that a college level course would prohibit you from seeking knowledge not presented in lecture and then prohibit you from using it to solve the assignments
I am thinking of it more like "approach the problem with only these tools, b/c that's all you'll need". I apologize if my previous post came across negatively. I meant that I find having to do the assignments with the limited information presented in preceding lectures and readings quite challenging, and if students in the actual course might have gotten away with using more advanced code. I also forgot about the study sessions.
I, too, found it really frustrating to do the problem sets as they occurred with the lectures & readings. PS1 didn't work for me until after the 4th or 5th lecture & readings. So rather than continuously be frustrated, I decided that I'm thinking more like a computer scientist if I'm NOT relying only upon the tools I've learned. As a result, I'm several lectures ahead of the problem sets I'm working on. Whether you strictly follow the syllabus or approach it some other way, I think you'll end up in about the same place. But there's no certificate, no grade. So ultimately it doesn't really matter how you get there. Just do what works for you.