 In this video, we're going to summarize what you've learned so far in this course and we will give a short outlook on what is to come. So first of all, let's look at the table of contents here. So we are at the end of chapter 4. And in the first 4 chapters, what we have basically talked about besides some very basic Python is how we translate the logic behind a problem into code. And this is what we as a software developer would call the so-called business logic. So it has nothing to do with the business in terms of making money. But the business logic of the problem is basically the rules as to how the algorithm should run. So how should the code iterate to solve the problem? What are the is-else logics built in and so on? That is what we refer to as the business logic. And then from now on, what we are going to talk about is we are going to center each of the chapters around a particular data type. And then we go into detail and learn about what this data type can do, how it works, and what we need it for. Okay? So in the next videos, we are going to look at numbers in particular, how numbers work, what do we need to know about numbers and then text and so on, and much more. And then chapter 11 classes, this will enable us to write our own data type. So at some point, we will reach a point where we cannot simply work with the basic data types that Python comes with. So that is then when we start to develop our own data types to solve some particular problems. Okay? So that is a short outlook. And now in this video, what I'm going to do is I'm going to classify the chapters that are to come, the data types that are to come. Okay? So let's create a new file and call it overview on data types. Okay? So classifying data types. So first of all, what you need to understand is the idea that there are so-called abstract data types, and then there are also so-called concrete data types. So what do I mean by that? So the easy concept is the concrete one. So a concrete data type is any data type that the built-in function type may return. Okay? We have seen this function in use. So as an example, if I ask Python what is the type of the number one, I get back int. Okay? And int is a concrete data type. And the concrete data type is something that I can use to create new objects of this data type. So we saw the notion of a constructor. A constructor is basically a class that is a technical term, and a constructor is basically a concrete data type that we can call to create new objects of this data type. So what we did as an example was let's take the number 7.1, the floating point number. And if I pass that to the int constructor, then I get back 7 as an integer. So that is what I mean by a concrete data type. I can use it to create concrete objects. Okay? And now in this video, we will go ahead and we will classify concrete data types into abstract ones. Okay? And one such classification is basically already the notion of a number or numbers in plural. So what kind of data types do we know exist there for numbers? Well, as we just saw, there is a data type called the int type. And this is what we use to model whole natural numbers, or let's simply say natural numbers. Okay? So, as we saw before, examples are simply, for example, the number 1. And then we also saw another data type already, which is the floating point data type. And this is what we use mainly to model decimal numbers, and I will put the word decimal in quotes. And maybe we can actually get rid of decimal. The reason why I don't like the term decimal is because decimal happens to be also a concrete data type, as we will learn in one of the future videos. So maybe let's replace that with irrational numbers. Yeah, you should know that from high school, there are natural numbers n in mass terms. There are the fractional numbers q. And then there are also the real numbers. Maybe we also could do that. That's probably a better term to use real numbers, the set of r in mass. And then the next set that we would have is a set of so-called complex numbers. And this also exists in Python. So let's first go ahead and create an example of a floating point number. Well, quite easily just rewrite it like this. And we will look in the numbers chapter in detail of other ways to construct numbers and so on. One more example that we have not seen in this course so far is the so-called complex data type. And of course, the complex data type, the concrete complex data type is there to model complex numbers, of course. And complex numbers for data scientists, a practitioner, are kind of on the edge of do you really want to study them or not. So my guess is for a beginner's course, no need to go into detail here. But let's say you want to really go into data science like deep dives, then you need to understand some mathematical concepts. In particular, you need to study a linear algebra in detail. And in order to do that, it is quite worthwhile to know about complex numbers by, you know, from your math course. But also it's worthwhile to know how to use them in code. Okay, but now let's take one level back here. So this is basically examples of concrete data types and the way we classify them. This is what we mean by an abstract data type. So why do we call it abstract? Well, all the numbers share similar behavior, okay? So in other words, when I say I classify concrete data types into abstract ones, what we really do is we basically classify common behavior, okay? And so what are behaviors that all the numbers share together? Well, for example, very trivial example, we can simply add them. So I can add one plus two, but I can also add two floating point numbers. So let's take the 7.1 and add it to 42.3, okay? So addition is shared among all the numerical data types. And we will look into that in the next videos in detail. So that's just one classification scheme. Another very important classification scheme is of course textual data or simply text for short. So in the very first chapter, we already saw how we can model text. So in Python, what we do is we use the double quotes to wrap any text that we want to model in our program. And as we see here, when I enter that into a code cell, I get back random text with single quotes. And I said that before, double quotes and single quotes are perfect synonyms. So Python defaults to single quotes. But in recent years, my guess is that the majority of the Python community started to prefer the double quotes. And this has to do with some code formatting tool called Black, which basically styles code in a uniform way. And this tool just prefers the double quotes over the single quotes. But some programmers still use the single quotes. And it's perfectly okay in Python because in Python, they have no different meaning, okay? That is also different to other languages. In some other programming languages, single quotes are often used to mean individual characters. And the double quotes used to mean more than a single character, so words and sentences. But in Python, it's pretty much the same. So it's not pretty much the same, it is the same. Okay, so that's an example of textual data. And in terms of behavior, what you could do is, well, you could, for example, go ahead and let's copy paste the text here. And we could use some method that basically can only work with textual data. So for example, the dot upper function or method. So the upper method simply uppercases the text. There's also, of course, the title method and so on. Okay, so what data type is this? What are we working with? Well, if we go ahead and use Python's type function to find out what data type we are looking at, it is, of course, the string data type, string, okay? And the string, the term comes from a string of characters, okay? That is why we call it a string for short. So yeah, and usually, string is pretty much the same technical term across all other major programming languages as well. So we can put that here into our header and say this is simply the string type to model so-called unicode text or unicode characters. And what unicode characters are, we will learn in the video, in the videos regarding chapter six. So for now, for short, unicode basically means any letter that in any language in humankind that ever existed. So we can model any kind of text, even smileys and other things. But we will look into detail once we do that. Then there is another data type that also goes through as textual data. And that may be new for some of you. So I will give you the type. The type is called the so-called bytes data type. And this is basically how text looks like or what text looks like for a computer. Okay, so this is basically the version that is close to the memory. And this has to do with a couple of conventions of how the zeros and ones inside a computer's memory can be parsed into letters and words. We won't go into detail here. I just give you that as a second example. So that you see that textual data as an abstract data type classifies more than one concrete data type, namely string and bytes. And we will look into detail in the chapter on textual data. Okay, so now let's go ahead and look at the next idea, the next abstract idea. And this is the idea of a so-called collection. Okay, let's do it like this, collection. So what is a collection? So a collection in Python basically summarizes three properties into one. So the first property is what we refer to, maybe let's make a list here. We refer to that as the so-called container property. And the idea is that an object, and this can be anything, so it cannot be anything of course, it is going to be a collection object. But any object that contains references to other objects is what we refer to as a container. And an example of that, so let me first write that in an object, or any object that is basically the proper definition, any object that holds references to other objects. And as an example, let's simply use lists, okay, because we have seen lists in this course before. And so lists is, or list objects are container objects. So this is an abstract property, so maybe let's also write there any object that fulfills these properties. The second property is the property that we call, yeah, the length. That is probably the best way to put it. There are also more formal words for that, but let's simply call it the length here. So any object that holds a finite number, and the emphasis is on the finite, a finite number of references. And now you may wonder, so an example for that would also be a list, because a list, as we saw before, is just finite. So you may wonder, isn't any object kind of finite? Because the computer memory must be finite, so we cannot just put infinite number of things inside an object. And the answer to that is, that is true of course, memory is finite. But there are technical ways in which we can model infinite data streams. And we will see that in the chapter eight, which is called MFR. So it is short for map filter reduce. And in this chapter, we are going to learn about data types that enable us to model an infinite number of objects, okay? And the opposite of that would be an object, for example, a list object that has a finite number of things. And any object that has a finite number of things in it, is what we call a length, where we say it has a length. Technical term, maybe let's put it here as well. It's called a sized object, okay? So this is how it is specified in the Python reference. Okay, and the third property is the property that we are going to refer to as a triple, okay? And this is simply any object over which we can loop. An example for that is also list. So maybe let's go ahead and copy paste the example up here, because the list fulfills all three properties, of course. So let's make this one dash. And any object that fulfills all these three objects together is what we refer to as a collection, okay? So if we go ahead and let's go to the Python documentation, maybe let's go into the library reference and let's maybe go into the site where we have spent most time to find this course, the page with the built-in functions. If, for example, we search for a term, let's say, iterable, we see that being used as the name of a parameter in many, many functions. So I have here only on this page 68 hits regarding the search of iterable. And so in other words, whenever in the documentation you read the term iterable, the only thing that is important is you can pass in any object, so any concrete data type that we can loop over. And for that, an example for that would, of course, also be a list object, okay? Let's see if we find more of these technical terms here. Let's maybe check for container. And here we see, this is not a container, but let's see if we find that here. In the documentation here it says, in a section that is so far not important to us because we will discuss dictionaries in the future video, but here it says, for other containers see blah, blah, blah, okay? And whenever you see the word container, well, basically what you can think of is any object that contains some other objects, okay? And now let's briefly go ahead and make an example. So let's take a list of numbers and let's put a couple of numbers in here. 10 numbers are enough. And now let's see how we can connect those three properties to operators. So in other words, any object that supports this particular operator that we are about to see is an example of a container, a lengthy object, or an iterable. So for the container property, there is the so-called in operator. So the in operator, let's maybe put that here, in operator is what implements so-called membership testing. And membership testing is simply, basically simply means we look up if the operand on the left-hand side is a member of the object on the right-hand side. So for example, I could ask the question if the number zero is in numbers. And the answer is of course false. Similarly, I could say is the number seven in numbers and the answer would be true, okay? The fact that the list object numbers here supports the in operator. So in other words, we can use in with numbers or a list object as the right-hand operand. This suggests and that the object is a container object. Okay, so that is how we can check the property. There are also other ways that I specify in the book, how you can check if the property is fulfilled or not, but using the in operator is the simplest one. And the in operator is also abstract in the sense that it simply checks if the left-hand operand is inside or is contained by the right-hand operand. It does not implement how this check is done, okay? And different data types will do this check in different ways. So for example, in the list case, what we do is a so-called linear search. So behind the scenes, and we don't see that as a Python programmer, what happens with the in operator is Python will basically loop over all the elements from left to right. And once it finds one that matches the one we are looking for, it returns true. It ends the loop, it's a short circuiting. We've seen that concept in a previous video. And it simply says, okay, I found one occurrence of the left-hand operand in the container. So yeah, so it's in there, it's true. And in the case where the answer is false, what happened was behind the scenes, Python loops over all the numbers through the entire list until the very end. And once it reaches the end, it sees, okay, I haven't found what I'm looking for. So the answer must be false. And different data types, in particular, the set data type and the dictionary data type that we will see in future videos, they work different in that regard. So the linear search may be very, very slow when we have a list with, let's say, one million numbers in it, okay? So this operation may take some time. It may, it takes exactly linear time as the computer scientist would say. And there are other data types, in particular, set and dictionary that go much faster. And we will see in future videos why this is the case. Okay, so for now, simply note that any object that supports the in operator abstractly speaking, no matter how it's implemented, is a container object. Let's go further. And let's see how we can check the sized property. And the way to do that is quite simple. And we saw that before. We simply go ahead and use the built-in function len, pass through it as the argument numbers, and I get back 10. And any object that supports being used with the len function is a sized object, okay? So let's maybe see two counter examples of objects where these two operations don't work. So for example, using the in operator, let's say if I'm given the number 123, I could try to use the in operator just like this. I could say, is the number one in 123 in the number 123? And we could think, semantically speaking, that this should be true because the number one is indeed a digit inside the number. However, the in operator gives me a type error and it says, argument of type int, so the right-hand side, that is what it means, is not iterable. And the not iterable is kind of misleading here because we are still working with the membership testing operator, the in operator. So what we would defer from this code cell is that the number 123, the integer object, is not a container because it does not support the int operator. And the reason why it's an iterable is because why it says here iterable is because what Python would do is it would basically loop over the digit, so to say from left to right in a linear search and that is why the error message here is a bit misleading, but really what we see here that the number 123, the integer object, is not a container. Similarly, if I go ahead and ask Python, hey, what is the length of the number 123? I also get a type error. So we could think of a situation where I get back the number three as the answer because I have three digits inside the integer, but that doesn't work. And the reason why is because the integer data type, the concrete integer data type, is not a sized object. So these are two counter examples and usually you get a type error when you use the wrong type with some operation, with some operator or some built-in function here. So let's quickly finish this discussion here. So the looping nature, we can simply check by saying four number in numbers. Let's say print number. Let's print everything on one line and it works. So we can loop over numbers. Therefore it is iterable, okay? So these are three properties that make up the term collection, the big idea for collection. Now the collection idea itself can be broken down into several other concepts. So let's look at a couple. So the first so-called specialization of a collection is what we would refer to as a so-called sequence. And this is why chapter seven here is called sequences or sequential data. So sequences are a special type of collections. So now what is a sequence? Well, a sequence is any object that additionally fulfills this one property. And in technical terms, the property is called reversible or reversibility. What this really means is we have a forward and backward order of the contained objects. And an example for that would of course also be the list object. So let's also write that here. Also a list is an example for that. So a list is not only example for collections in general, but also for the special kind of a collection called the sequence. And you may wonder why do the programmers here use such a weird word? Well, why wouldn't they just call it forward order? Well, the thing is reversible order basically implies forward order, right? If we can reverse something, there must be a forward order to begin with, otherwise we couldn't reverse it. So how could you check that? Well, there's a built-in function called reversed and the built-in function reversed takes, for example, a list object. And I get back something called an iterator. We will look into what iterators are in chapter eight. An iterator is basically the idea of an object which we can loop over, but we don't know how many elements will come out of it. So it's like a rule in memory that basically allows us to get the next thing and without looking beyond that. And now what could we do here? One thing we could do is we could say for number in reversed numbers, print number and print everything on one line. And now I'm basically reversing all the numbers. So I'm looping in backward order and any object over which I can loop in backward order is a sequence, okay? And sequences are probably among the most commonly used data types in programming besides mappings, which we'll look into next. And the reason why is because there are many applications of sequential data. So if you think of a CSV file or an Excel file, that is sequential data, a matrix, a vector, everything of that is an example of a sequence. So there are many abstract things that can be modeled as sequences with the various different sequence, concrete sequence types, okay? So let's look at two more specializations of a collection. And the next one is what we are going to call in general terms, a mapping. And an example for mapping would be the so-called dictionary data type. So let's simply call it, yeah, let's write it out dictionaries. Kind of like lookup tables, but I don't want to go too much in the detail here. I simply give you an example. So an example of a dictionary would be, let's say I want to map numbers to text. So what we do is we write curly braces. This is new, we have not seen this in this course so far. And now I'm going ahead and I will say the number zero is going to be mapped to the word zero. The number one is going to be mapped to the number one. And the number two is going to be mapped to the word two. And let's assign that, let's first check what is the data type of numbers to text. Of course, dictionary. And what can we do with a dictionary? So we could, for example, index into it. So we saw the indexing operator before. I index with zero. I get back the word zero. Okay, so there are lots of applications for that. Dictionaries are the secret of how we can make our recursive version of the Fibonacci problem efficient. That is one of the previous videos we saw that the recursive implementation of Fibonacci is not efficient, it suffers from exponential growth. And using dictionaries, we can actually repair that and we will look into that in a future video. Okay, so that is one example. And we will see further examples when we talk about mappings here, of course. And then also related to mappings is the concept of a set. Yeah, let's just call it sets. And as an example, as a concrete example of the abstract set idea is the so-called set data type. So maybe we model mathematical sets here. So let me give you one example. And again, we will look into a lot of detail of why the set data type and the dictionary data type are related so much. But for now, let's go ahead and simply write curly braces. And instead of writing some notation with a colon and the commas here, I will skip the colon part and I will simply do this. I will go ahead and write a couple of numbers in here and I will repeat the numbers and I will repeat the three a couple of more times. And maybe I will also go ahead and put in some unordered numbers. And let's go ahead and execute the cell and I get back a set data type. And we see, maybe we missed a nine here. So let's put in a nine also. And what we see here is that all of the redundant numbers are basically gone. And that is because that is how sets work in mathematical background. So in math, an element can only be either member of a set or not be member of a set. So it's a one or zero question. You cannot be a member of the same set more than once, okay? There are other concepts called the multi-set and so on, but for normal mathematical sets, you can only be a member of the set, either you are it or you are not it. Okay, it's a one or zero question. And also somehow, and this looks weird, the order is changed. So what we learned from that is that the set data type, maybe let's write here, loses the order. So in other words, there is no order, okay? So maybe when we talked about sequences and we talked about the property of being reversible, I said anything that has a forward and a backward order and as an example, I gave you a list. Well, now we have an example of a data type, of a concrete data type that is definitely not ordered, okay? So the set data type, the concrete set data type in Python is unordered. By the way, the dictionary data type is also kind of unordered, but here we have to learn a little bit more details about how the ordering works here, but you should also not rely on the order here, okay? So order is also something that needs to be modeled explicitly in programming. Okay, so this is basically, roughly speaking, a classification of all the concrete data types that we will look at into the next couple of videos in probably the second half of this course. And this is also how the chapters are organized. So this is the concept behind it. And let me repeat the big ideas from this chapter here from this video. The big idea is that you have to be able to understand that there are abstract concepts, abstract data types. So numbers in general, for example, textual data in general, collections in general, and so on. And then there is the concept of concrete data types. And concrete data types are types that exist in Python that are built in or that later on in the chapter on classes that we can define ourselves and they model data of a certain type and they can be classified into the abstract data types. Maybe one thing that just comes to my mind, in an earlier video when we talked about functions in chapter two, we also introduced the term so-called callable. And I said to you that a callable is any object that can be called, right? So in other words, callable, maybe let's put that down here as the last couple of points. So a callable is of course also an abstract data type. Anything that can be called is a callable. And the concrete examples were the user defined function that we would define with a dev statement, but also, and this is the data type of, for example, the built in some function is built in method or built in function or method. So basically we have another example, which is the so-called built in function or method. Okay, so we have the function type, the concrete function type, which is the user defined function. So let's write that here. User defined function and also the built in function and also maybe let's do that to finish this chapter. If I ask the question, what is the type of integer of a constructor, I get back type. And anything, any object whose type is type is what we formally refer to as a class. And in this course so far we have been referring to that simply as constructors, okay? So maybe let's write here constructors. Okay, so we have three different concrete data types. Built in function and type that all share one commonality, which means they can be called. So they are all callables. Three concrete examples, one abstract example, the abstract classification, okay? So this is how an experienced programmer thinks. An experienced programmer thinks usually in abstract terms and then if he or she finds a concrete data type that fulfills the properties needed to solve some problem and then we will, yeah, then we still need to know how they compare, how to concrete data types, compare which advantages and disadvantages they have. But first and foremost, if you want to solve a problem, usually as a programmer you kind of think in these abstract terms of how you want to break down the problem and then you choose whatever concrete data type fits the abstract data type that you need and then you will simply go ahead and solve the problem. And also a nice side effect and that is also one of the main reasons why I introduced these ideas in this course is knowing the abstract data types makes it a lot easier for you to read documentation. And I know I would not be a good teacher if my goal were not to enable you to read documentation because you should be self-reliant after this course. You should be able to find your own way in the Python community and solve your own problems where I cannot be of help. And the number one skill you need to develop is to read technical documentation even if it's in the beginning very hard to do so, right? And knowing the abstract data types really, really makes it easy to understand the documentation here. So that is it for this rather long video. And now I hope you have a good overview of what is there to come. And in the next videos, we will look at all of these things in very much more detail. So I see you then.