Data Structure exercise :

So Mosh is showing me, us, another way to solve the exercise by importing modules, but when did we learned about modules? I mean I get it, extra information is welcomed, but we need to learn about it first, because I am sitting here and wondering : where did that(" from pprint import pprint") came from?! Same case in the Generator object lesson - from sys import getsizeof() . I think we need to learn it first, then to go through it, not really complaining, I just want to understand things as best as I can

Importing packages is a very powerful way to bring in some extra features/functions into your own code. All languages that I have work with including C/C++, Java, C# and even R has the same concepts. The standard Python comes with many of these packages that you can use (if you know about them!). pprint is one of them. What Mosh shows here is just how easy it is to increase the stuff you can do using a simple import statement. There is actually not much to learn about this, just to know that may of the problems we are trying to solve has been solved by others and sometimes these solutions are made available through packages.

There are some really powerful libraries available such as numpy and pandas which are collections of class and functions that work very well with numbers and data. These we always include through simple import statements making al these powerful functions available in our code. But unlike pprint, these are not included in the standard Python libraries and you need to install them first. This is also very easy, but I am sure Mosh will cover this somewhere in the course.

1 Like

sometimes you may find some suggestions as “out from the hat”, and that’s weird.

It’s ok, be patient and later you surely will find the “a-ha” moment and everything will fit in.

It’s a matter of convenience to present new knowledge. Not everyone of us learn the same way and it’s ok.
Trust Mosh, I found he deserves it.

1 Like

Thank you @ariel.robaldo !

1 Like