RUVIDEO
Поделитесь видео 🙏

Lesson 1 Python, variables, print and type function, str and int data type

!!! While we have a new channel, I cannot add links with information to the description. Therefore, they will be in the comments !!!

Hello, in this lesson, we will discuss variables and data types such as 'str' and 'int', and get acquainted with built-in functions print and type.

Variables in Python allow us to store and process information. They're the key to efficient coding. Watch to the end to understand how to work with it

To record data in a variable, we follow an algorithm: first, we write the variable (the left part of our expression), then we put an assignment sign (which will separate the variable and its value), and on the right side of the expression, we write the data we want to assign to this variable. It is important to understand that although we say that we are writing to the variable, it works a bit more complicatedly; actually, we write a link to the data in the variable. But we can ignore this for now.
variable first_variable and its value 10

Consider this sign that we write as an assignment, not as a mathematical sign of equality.

ten, as we know from school mathematics, is an integer, so the data type we use here will be int. We don't need to specify additionally that it is int, Python will do this job for us.

Here are some more integers, which will also be included in data type int

Let's consider another data type. STR, abbreviated from string
When we want to write data as text, this data type, str, suits us best. In order for Python to understand that this is the str data type, we need to put the right part in double or single quotes. Single or double doesn't matter. You can also use triple quotes, but more on that later.

let's write this
we will have a variable "first_variable" and a value. "Our YouTube channel is code_way" so write it.

Now the name of the variable is highlighted because this variable already exists in the code and it will be overwritten, the code in Python is executed from top to bottom, and from left to right. Let's display our first message. For this, we will use the built-in Python function print, To use it, we need to first write the print function, open brackets, this will trigger our function, and inside the brackets, pass the variable the value of which we want to display. To run our program, right-click on our code and click run in the menu.

Sometimes we need to find out what data type our variable belongs to, to understand how to interact with it. For this, we need to use function which named type. We write the name of the function type, open the brackets so that the function starts, and pass the variable, the data type we want to find out. We run the code and see that nothing has changed, but it should have. This is because if we want something to be displayed, we need to use the print function, let's use print function and run it, see everything works. In addition to the data type, you may also notice the class, don’t pay attention to it yet, the right part of the expression is essential to us.

we can also save the result of the type function in a variable and then display it.
It works just as in the previous case.

Let's do it this way.
Now we have two separate variables, not just one that gets overwritten. As we had in previous case.

Before running this code, so that everything doesn't merge into one array, let's use an empty print to separate the text.

When we run it, we can see the variable type and its value. You might also have noticed that this time I passed two variables to print. In print, you can pass multiple variables; you need to separate them with commas.

Our variables are case-sensitive. If we have a variable with uppercase and lowercase letters, these will be two different variables.

Let's display them on the screen.

Run it, and as you can see, both values are displayed and nothing gets overwritten like in the example with the first_variable.

Let's agree that for now, all our variables should be written in lowercase and after each word, we put an underscore. By the way, this method is called snake_case and is used for naming variables and functions in Python.

It's also important to know that variables cannot start with a number. Let's write one like that and we'll get an error.

Run it and we encounter our first error. We will talk about errors later. Notice how Python points out exactly where our error is.

Try to name variables in such a way that by their name, you can understand what is stored inside. For example, in 'name', we write the person's name. In 'age', we write how old they are.

This video has come to the end, congratulations you are one step closer to your goal. Check out the description you can find there test and other materials to help you better understand the topic. I would appreciate like and comment for this video.

Что делает видео по-настоящему запоминающимся? Наверное, та самая атмосфера, которая заставляет забыть о времени. Когда вы заходите на RUVIDEO, чтобы посмотреть онлайн «Lesson 1 Python, variables, print and type function, str and int data type», вы рассчитываете на нечто большее, чем просто загрузку плеера. И мы это понимаем. Контент такого уровня заслуживает того, чтобы его смотрели в HD 1080, без дрожания картинки и бесконечного буферизации.

Честно говоря, Rutube сегодня — это кладезь уникальных находок, которые часто теряются в общем шуме. Мы же вытаскиваем на поверхность самое интересное. Будь то динамичный экшн, глубокий разбор темы от любимого автора или просто уютное видео для настроения — всё это доступно здесь бесплатно и без лишних формальностей. Никаких «заполните анкету, чтобы продолжить». Только вы, ваш экран и качественный поток.

Если вас зацепило это видео, не забудьте взглянуть на похожие материалы в блоке справа. Мы откалибровали наши алгоритмы так, чтобы они подбирали контент не просто «по тегам», а по настроению и смыслу. Ведь в конечном итоге, онлайн-кинотеатр — это не склад файлов, а место, где каждый вечер можно найти свою историю. Приятного вам отдыха на RUVIDEO!

Видео взято из открытых источников Rutube. Если вы правообладатель, обратитесь к первоисточнику.