I took Mosh’s course on Python a week ago. I came across a statement that I found not easy to understand and I need some help to understand it. Take the following code which involves the get method which is used to extract a value from a dictionary: Below is the code of which there is one statement I could not understand.
self.tags takes a list of tag
and sets it get method that takes in the same list, so as the get methods recieves the tag list, we add 1 to our varaiable self.tags[tag] and now uses the tag paramenter as our key in our dictionairy
Thanks Jarvis. OK what happens when we bcall the add function
add(self, tag)
in terms of the class function which declares the tags as {} dictionary. Tha is, what happens when we call the function. Is theclass executed first without calling the add function. Thanks