Cookie Jar -Problem Set 8 (CS50's Introduction to Programming with Python)

preview_player
Показать описание
Hello, everyone and welcome to another video, in this video, I will explain and solve problem set 8, Cookie Jar.

if you haven't already submitted this problem, You have to try this on your own.
This video is to just give you a way to solve this problem, try solving it using a different approach, to get the most benefits out of this experience.

Don't forget to hit the like button and subscribe to the channel, and if you have any questions or want an explanation for a specific problem leave a comment down below.

Рекомендации по теме
Комментарии
Автор

JESUS YOU'RE THE ONLY ONE WHO MADE IT CLEAR FOR ME WHY WE SHOULD USE UNDERSCORES BEFORE CAPACITY AND SIZE cannot thank you enough i was beginning to lose my mind 🙏🏼

helpletmego
Автор

You didn't check whether capacity is an integer, but it's not required to pass check50.

andrejg
Автор

very usefull video!! but i still have a question, why does the excersice tells us to use the @property? the only way i see it usefull is to set the capacity and size variables to private to avoid collision but they are not even necesary involved in this excersice. it can be still done correctly without them

santiagootero
Автор

Hello brother. The biggest problem for me by now is this problem set. I watched carefully whole lecture from David Malan and still kinda cannot imagine the usecase of this whole .class methodology.... I think there is much more simpler way to solve such problem set without all these class methodology usecase. I just can create proper functions and variables and implement them with the tests as well. And provide exact same results but in a simpler manner. I'm confused because all this class case messed in my head within @property whereas I should add _ underscore before method in order not to crush the wole programme. There are so many messy things in here and I think I should get much more exercises to even scratch the problem. Do you have any advises? Thx!

arturwyscioek
Автор

for me i can't change the variable names by adding _ and then use the non _ version to compare. It says the variable doesn't exist. I have to add _ to everything not just when assigning.

HellmiauPlays
Автор

Damn you made this look so easy! Thanks for the great video.

MFM
Автор

"if n > self.capacity or n + self.size > self.capacity:" can just be expressed as "n + self.size > self.capacity:" no?

unicyclerforlife
Автор

how to test this class in cases when it raises ValueError? I can't find the solution anywhere...

elhamhosseini
Автор

The thing is we use "_" this because I believe of "overloading" instead of useing "_" cant we change the function's name?

slim_t
Автор

damn i spend 2 days thinking that if i deposit 2 cookies, when my code stop running it should keep the 2 cookies and if i run the code again it should be 4 cookies, i was already doing everything the problem required and losing my mind over this😅, at least i spend a couple more hours studying the class method than i would otherwise, thanks for clarifying to me what i was supposed to do

CauêCarvalho-pp
visit shbcf.ru