0 characters
5. Introduction to the section «The very basics of Python»
Summary- In this section, we will look at the main points of Python, including syntax, data structures, and conditional instructions.
- Let's start with an example of a simple alarm clock in Python and look at data types, including numbers, strings, lists, dictionaries, tuples, and sets.
- We will also discuss assignment operations and operations with various data types.
- Consider formatting strings using the
%
operator, theformat()
method, and f-strings.- Let's continue studying the conditional construction
if/elif/else
and the operatorsin
,and
,or
and `not'.- Let's study data type conversion and validation to prevent problems with mixing types.
- Learn how to use chains of methods to optimize and reduce the amount of code.
In the previous section we got to know the Python programming language, console I/O operations, and variables superficially. In this section, we will begin to dive into the Python language. Next, let's look at the main points of the section:
Let's start with the example of a simple alarm clock in Python, in which we consider the syntax of the language, some built-in data structures, and the use of dot notation to refer to the attributes of a time object. In the same lesson, for the first time we will get acquainted with the conditional instruction
if/elif/else
, which is needed to change the progress of the program.
In the alarm clock example, we touched on many important topics. One of them is data types. In the lesson Data types in Python let's look at this topic in detail. Let's talk about numbers, strings, lists, dictionaries, tuples, sets, and logical data types.
Let's find out what typification the Python language has and get acquainted with the concept of "Data Model". We will also discuss how the assignment operation works and what operations are possible with different data types.
We will often have to work with strings, so let's look in detail at the various ways of formatting strings: the
%
operator, theformat()
method and f-strings.
In the first lesson we just got acquainted with the usual construction of
if
. Here I continue with a lot of useful information: when you use the keywordselif
andmore
, natural and important meanings. We will also get acquainted with the operatorsin
,and
,or
,not
.
In a programming language with strong typing, there may be problems with mixing types: we talked in the lesson about data types. In order not to face these problems in the future, we will study how to convert and verify data types.
Let's learn how to use chains of methods to optimize and reduce the amount of code. The lesson is presented for informational purposes, as you will find method chains everywhere in someone else's code in Python and other languages.
We have got acquainted with the main topics of the section "The very basics of Python" and can move on to first lesson.
Test task
Subscribe to our Telegram channel!
News, useful material,
programming and InfoSec