📱

Get Our Mobile App

Take your business learning on the go!

Download on the App StoreGet it on Google Play

ВЕСЬ PYTHON ЗА ЧАС

ПИТОНИСТЫ | КИРИЛЛ ПОЗДНЯКОВ1:05:16

Transcription

Hello everyone!

Today we have a video covering everything about Python for a certain period of time. I don't know yet how long it will be, as I haven't started editing, but that's not the point. We will look at everything we have. Naturally, Python has a multitude of different functions, capabilities, and more.

To learn everything in an advanced format, with plenty of examples and tips on how to pass interviews, solve problems, and generally live with Python, head over to my Telegram channel. The link is in the description. Just scroll down, and you'll find it. Subscribe and keep an eye on it. Also, make sure to subscribe to my YouTube channel.

Let's start with the fact that we have our Python. To work with it, you need to install it. I won't dwell on this. Just go to the downloads page, install the current version of Python, and get to work.

What else should we mention? Python and programming languages, in general, are divided into interpreted and compiled languages. Python is an interpreted language. The essence of an interpreted language is that it has an interpreter that executes the code line by line. In contrast, compiled programming languages work on the principle that we have a bunch of code, we compile it, and then we run this bundle. Some languages are a combination of both interpretation and compilation, like Java. Python also has a similar feature, which I will show you now.

Python has a specific extension, .pyc files, which are essentially a form of compilation of our Python code for faster execution. This feature appeared in newer versions to optimize performance. It's important to understand that interpretation is the foundation of Python, and mentioning that it's a combined approach can help you stand out in interviews.

Now that we have installed Python, what else do we need to know? Most programming languages have package managers, and Python is no exception. We have a package manager called pip. What is it? With pip, we can install various dependencies. Python, by itself, is a language where we write something, which is good, but to make it work for our needs, we need dependencies.

For example, if we want to make requests to a server, we look for our library, requests, and check the documentation. We see how to install it with the next command. It's not crucial to understand everything about the package manager right now, but it's good to know it exists.

Now, let's move on to our Python. I've divided the content into sections, and we will go through them. Naturally, there are many different aspects to cover. Everything is available in an advanced format in my Telegram channel, so make sure to subscribe.

Let's start with variables. In general, variables can be categorized into several types: integers, floating-point numbers, complex numbers, strings, lists, dictionaries, sets, and tuples.

Let's start with integers. We have our regular integers, including negative numbers and floating-point numbers. Floating-point numbers can also be negative or positive. Complex numbers are a mathematical concept that may not be useful for everyone, but they are available for discrete values.

Next, we have strings. Strings are created by opening parentheses and writing something like "Hello, world!" and then closing the parentheses.

Lists, or arrays, are a collection of values. For example, if we have 5 values, we can combine them into a list: [1, 2, 3, 4, 5]. The numbering starts from zero.

In lists, we can include any data types. It's important to understand that a list is simply a collection of several values, and the numbering starts from zero.

Now, let's talk about tuples. Tuples are different because they are fixed. When we create a tuple, we cannot change its length. For example, if we have a tuple with two values, we cannot add more values to it.

Tuples are created faster than lists. If you need a fixed value that won't change, tuples are the way to go. Lists take a bit longer to create.

Next, we have dictionaries. The principle of dictionaries is that we have a key and a value. It's also important to understand that lists, tuples, and dictionaries work on the principle of unique values.

Sets are an unordered collection of unique values. Boolean values can be either True or False, or NaN when there is no value.

When we work with variables, we create a reference. For example, when we assign a value to a variable, we allocate a memory cell for it. If we change the value, the original memory cell loses its reference, and the garbage collector will remove it.

In Python, the garbage collector automatically manages memory. If we stop referencing a value, it will be cleaned up, which improves performance. In languages like C++, we have to manually manage memory to avoid leaks.

Now, let's talk about copying values. There are two types of copying: shallow copy and deep copy. A shallow copy copies the top level, while a deep copy copies all levels.

For example, if we have a list of lists, a shallow copy will only copy the outer list, while a deep copy will copy everything, including the inner lists.

We can also use slicing to copy lists. Any method that returns a new array can be considered a way to copy.

Now, let's move on to methods for our data types. We have numbers, strings, lists, dictionaries, sets, and booleans.

Starting with numbers, we have addition, subtraction, multiplication, division, and integer division. We can also raise numbers to a power and find the remainder of a division.

There are many mathematical methods available in Python, including modules like math. We can work with various mathematical operations, and if you're familiar with math, you know what I'm talking about.

When working with strings, we can convert them to upper or lower case, strip whitespace, replace words, and split them into lists. We can also join lists back into strings.

In Python, we have f-strings, which allow us to embed expressions inside string literals. This makes it easier to format strings without cumbersome concatenation.

Next, we have boolean values, which can be either True or False. We can convert values to boolean, and it's important to understand that zero is always False, while an empty string is also False.

Now, let's move on to lists. Lists are a big topic because they allow us to combine different data types. We can add elements, insert them at specific positions, and remove elements by value or index.

We can also sort lists, create sorted copies, and use list comprehensions to generate lists quickly.

Now, let's talk about dictionaries. A dictionary consists of keys and values. We can modify values, delete elements by key, and retrieve values by key.

Sets allow us to add and remove elements, check for existence, and perform set operations like union and intersection.

Now, let's discuss classes. Classes are a way to create objects in Python. They have attributes and methods. We can create instances of classes and use them to encapsulate data and behavior.

Inheritance allows us to create subclasses that inherit from parent classes. We can also use encapsulation to restrict access to certain attributes and methods.

Finally, we have decorators, which allow us to modify the behavior of functions. They are useful for logging, access control, and other cross-cutting concerns.

That's a brief overview of Python. If you want to dive deeper into any of these topics, check out my Telegram channel for more detailed explanations.

If you found this interesting, please subscribe, like, and share with your friends. Let's stay connected!