Skip to playerSkip to main content
The Basics: Data Types

Learn the fundamentals of data types in this beginner-friendly course designed for aspiring programmers and tech enthusiasts. In this video, we break down the most common data types, explain how they are used, and show why they are essential in programming and data handling.

Whether you’re just starting your coding journey or need a refresher, this course will help you understand core concepts clearly and confidently.

🔹 What you’ll learn:

What data types are
Common data types (numbers, strings, booleans, etc.)
How data types work in programming
Practical examples for beginners

🎯 Who this course is for:

Beginners in programming
Students learning computer science basics
Anyone interested in understanding data structures

👍 Don’t forget to like, comment, and follow for more educational content!

#python #programming #coding #java #javascript #snake #programmer #developer #html #computerscience #reptile #technology #snakes #reptiles #ballpython #pythonprogramming #coder #datascience #snakesofinstagram #css #linux #code #machinelearning #reptilesofinstagram #software #webdevelopment #php #webdeveloper #tech #pythons

Category

🤖
Tech
Transcript
00:00before we go into coding, I want to show you a productivity tip regarding the IDE. Now, this tip is about the Visual Studio Code IDE, but it will probably apply to other IDEs as well. It's about the terminal how to use the terminal more efficiently. And this will help you with coding
00:30and also with the learning part. So this is what I want to show you. I have my terminal open here. So first of all, what I want to do is I want to delete all the terminals using that icon or the icon could be somewhere in here. So just delete everything. Yeah, the icon shows here now. Press that or the other one until the terminal disappears.
00:54And then you want to show the terminal again. And you can do that by pressing this button. So that will execute the code. It will create a new terminal window. And then it's good to have a Python shell open on the side as well.
01:13So you have both the command line where you run the code, but also the Python interactive shell where you can write quick one liners. So to do that, you want to press this icon.
01:26And that will split the terminal. So now we have one terminal here on the left and one terminal here on the right. Here on the right, what we want to do is execute the Python command, which opens the Python interactive shell.
01:39So on Windows, that is py space minus three, on Mac and Linux, that would be Python 3.10 or Python 3.11, and so on.
01:51So that will open the Python interactive shell. Now we have both the command line where we execute that py files and the Python shell, where you run codes interactively.
02:05So that will help with your learning. So let me quickly demonstrate to you if this is working fine or not. So I can have the focus in here, it doesn't matter.
02:17And I press that button. But the code will be sent to that terminal. And this terminal here is independent of that.
02:27So again, if this is not working, make sure again to delete everything. So no terminals. And then don't open a terminal here.
02:36So instead of doing that, let the terminal be opened using that button. That way, you make sure that this terminal is connected to the running process of this file.
02:49And then you split the terminal. And then you split the terminal and then you have that commands to open Python.
02:57Another tip before we close this video.
03:00On the command line where the Windows or Mac or Linux commands are sent.
03:06So in here, when we run the .py file, you can clear the terminal using CLC.
03:13So write CLC there. If you are on Windows on Mac, it would be clear or Linux as well.
03:21So CLC, press enter, and that will clear the terminal.
03:25So this works on the command line, not on the Python shell.
03:31Regarding the split window here on the side, you can see how many terminals, terminal panes you have.
03:38So we have this, which is pointing to this on the side, on the left side, and then the other one on the right.
03:47I would suggest trying not to have more than two terminals here because things can get confusing.
03:53Because if you press that plus icon, you're going to have a third terminal, which is going to be hidden behind these two.
03:59And things will get confusing.
04:00So make sure you always have two.
04:03If you have more, delete everything and start the process again.
04:08Run it.
04:09Run py-3 again, and so on.
04:12So with that, you're ready to program in the next videos.
04:16This will really, really help you with your learning.
04:20So I'll talk to you in the next video.
04:22Let me demonstrate you something.
04:24I'll create the x variable, store 10 in that x, y variable, store the text 10 in that variable,
04:34and then create two new variables.
04:37Sum1 equals to x plus x, and sum2 equals to y plus y.
04:47And then print sum1 and sum2, save the script, don't forget, and execute it.
04:59This is the output.
05:00So we got 20 out of x plus x, and 10, 10 out of y plus y.
05:08What is my point here?
05:09My point is that computers are dumb.
05:12In order for them to understand you, you have to be very clear, very explicit in what you're
05:19going to say through your language, through Python in this case.
05:24It's not enough to just say 10.
05:27You have to declare what that 10 is.
05:31Is it a number or is it text?
05:33That's why in some languages, in most of the languages, we have type declarations.
05:38So in other languages, you would say something like int, which stands for integer.
05:44So you are saying that this is an integer.
05:4610 is an integer.
05:47And this would be like str, y, without quotes.
05:53So that tells Python that this is actually a text and should be treated as so.
05:58So when Python, when you apply a plus operator, Python will concatenate that text.
06:03So it will add 10 after 10, and it will make this concatenate a string.
06:10Now, this is not how it works in Python.
06:12In Python, instead of doing these explicit declarations, we have implicit declaration
06:17instead, which is this one in here.
06:20So when the number is without quotes, it's an integer.
06:24Well, it can also be a float, but let me talk about that in a few seconds.
06:28And if it's with double quotes, it means it's a text.
06:33If it's z equals to 10.1, for example, that means it's a float.
06:42And if you don't believe me, you can use the type function like that.
06:50X, type Y, and type Z.
06:57The type function will print out the type of each value.
07:03So it's a class int, a class str, which stands for strings.
07:08Everything in quotes is a string.
07:11And floats, which stands for float.
07:14With strings, you can also use single quotes, like that.
07:20Save it, and you're going to get the same output.
07:23So if your intention is to process text, you need to use quotes.
07:28If your intention is to process numbers, so to be able to make mathematical calculations with them,
07:35you need to use them without quotes, like that or like that.
07:40Now you know three data types in Python.
07:47You know integers, you know strings, and you know floats.
07:52These are simple data types.
07:54We also have what is known as compound data types.
07:58Types that are made of different objects.
08:02And the list is the most popular one.
08:05So in a list, you can actually store multiple objects.
08:09Let's suppose you are a teacher, and you want to calculate the average grade of your students.
08:15So you use Python for that, and you need a data structure to store those values in Python.
08:21You need the proper type in Python to represent the grades of your students, and the list would be a good choice.
08:31Let's create a list.
08:33Store it in a variable.
08:34As usual, student grades equal to open square brackets, close square brackets.
08:41So the objects now will go inside this syntax.
08:45So you saw that with integers, you'd use a number without quotes for strings to tell Python that that is a string.
08:53You use double or single quotes.
08:55And with lists, you use these square brackets.
08:59So every type has its own syntax.
09:01So let's say 9.1 and 8.8 and 7.5.
09:07Those are the grades of your students.
09:15In this video, you will become more familiar with lists.
09:21So previously, we stored three float data types in a list, but you can store any type of object, not only floats.
09:31So we can store an integer, such as 9.
09:35You can store a string, such as hello.
09:39You can even store lists inside a lists.
09:43You just write the square brackets, and then enter the items of that list.
09:52So still, this list has three items.
09:55This integer, this string, and this list.
09:59And of course, you can pre-note that list by pointing to the variable associated with the list.
10:07And that's the output that we get.
10:09Now, math operations with lists.
10:13What does list support?
10:15Well, not much, really.
10:18You can do multiplications with an integer, such as 2 or 3.
10:25And let's see what's going to happen.
10:27So I'm going to print out that expression directly here.
10:31Instead of putting that in a variable.
10:33So whatever you prefer, you can create a new variable, store that in the variable, and then place the variable in the print function, or directly place this expression in the print function.
10:45Both will work.
10:46So if you run that, you're going to get this output, so that's the same list repeated three times.
10:59If this was plus, this is not supported, because Python doesn't know what to do with a list and an integer.
11:07So it gives you an error, type error, only can concatenate lists to lists.
11:14So it can concatenate lists to lists.
11:17So if you do student grades plus student grades, that will also work.
11:22So run that.
11:24And you get this result.
11:26So the list repeated two times, which is the equivalent of that times two.
11:33So, again, we're going to get the same results here and there.
11:40Lastly, there's also a way to auto-generate lists of integers that have a certain order.
11:49Let's say you want to have a list from 1 to 10.
11:531, 2, 3, 4, 5, 6, 7, 8, 9, 10.
11:56How can we do that?
11:58Well, of course, one way is to write that down, but there is a better way.
12:02And that is to use a range.
12:06Range is another type of object.
12:09Just like we have lists, integers, we also have ranges.
12:14So range, 0 and 11.
12:18And let's run student grades to see what this variable has now as a value.
12:24So run that.
12:26And this is a range object.
12:28So not much to see yet, but if you convert this into a list and run again.
12:39Lastly, we're going to get that output.
12:41So 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10.
12:43So now student grades is a list object.
12:47And this list keyword here is a class.
12:51So it represents the list data type.
12:55And it is used here to convert a range data type into a list data type.
13:02Because a range displays simply like this.
13:06So this is not very beneficial to see.
13:09The output is not so clear.
13:10So we convert it into a list data type.
13:13And so how does it work?
13:15Well, it starts from 0 up to the number before this number, which is 10.
13:22So 0 to 10.
13:23That's why we have 0 to 10.
13:24Of course, you can have anything here.
13:27So 1, 2, 8.
13:29I would have to write 9 to get 1 to 8.
13:33So at least 1 to 8.
13:36You can also have another argument here, 2.
13:42And let's see what that changes in the output.
13:44So we get these results.
13:51That, too, is the step.
13:54So 1, 3, 5, 7.
13:56It means that you start from 1.
13:58And then you move by a step of 2.
14:01So 1 plus 2, you have 3.
14:033 plus 2, you have 5.
14:055 plus 2, you have 7.
14:067 plus 2, you have 9.
14:08But 9 is not included in the range.
14:11The range is up to 8.
14:13So the list will end up at 7.
14:17Of course, you can have any steps here, like 3, and you'll get different results.
14:24So that was some more advanced information about lists and also ranges.
14:30With that, I thank you, and I'll talk to you in the next video.
14:32See you there.

Recommended