I just copied the video, but I got different result.
My result is {‘python’: (((0, 1), 1), 1)} instead of {“python”: 3}
Another question: Why “get” in line 5 and “TagCloud” in line 6 don’t change color in my computer?
Thank you!
-
class TagCloud:
-
def init(self):
-
self.tags = {}
-
def add(self, tag):
-
self.tags[tag] = self.tags.get(tag, 0), + 1
-
cloud = TagCloud()
-
cloud.add(“python”)
-
cloud.add(“python”)
-
cloud.add(“python”)
-
print(cloud.tags)