Oh, I definitely feel that you wish to move to practice. Please, wait a little more. The more efficiently we work with you now, the better we perceive and understand, the easier and faster our subsequent work will be!
You can't snap you fingers and get systemic thinking, but when you take efforts and get it, it will change everything: new horizons will be open, speed will increase, special skills will be improved, IQ will rise, appetite will become more appetizing, energy - more energetic, future - brighter. So, keep attention and focus. The battle is about to begin!
Humans have 5 basic senses: sight, hearing, touch, smell and taste. By the way, different sources classify senses differently. Some of them claim that there is the sixth sense - spatial orientation. It includes a sense of falling down, lifting up and so on. Buddhists describe one more feeling - "mind", usually restless and constantly worrying, in a word, unhappy.
Human is magnificent, the supreme creation that invented geography, coffee and toilet paper, but we are studying computer science. How much "senses" does a computer have?
Five. But distinct from the human ones. Computer "senses" are called the types of information which a computer can receive, process and output (by analogy with a person: receiving information by looking, processing by thinking, outputting by telling what has been seen).
A computer receives, processes, outputs:
Perhaps, computers will be taught to reproduce and to understand smells or tastes in far far future (or in close future, nothing is exact nowadays). They will be taught to swear from their iron hearts, to respond emotionally and sincerely. PCs will learn the sense of humor, and then they'll start to troll their owners. Highly professional trolling, with best knock-knock jokes. Sound awesome, eh?
So, let's repeat: numbers, text, graphic, video, audio. That's all. So far, a computer doesn't understand anything else. But even here there is a snag.
The thing is that all data (and text, and numbers, and I'm the map 1 hour long version clip, and the "How to Talk to Your Cat About Gun Safety: And Abstinence, Drugs, Satanism, and Other Dangers That Threaten Their Nine Lives" book in PDF-file) are stored in a computer in the form of ones and zeros.
It's named binary system. Only zeros. Only ones. The text you're reading right now is stored in memory, processed by CPU of your smartphone (tablet or maybe remote control) as a coherent and incomprehensible set: 01110100001101...
Not a lot, right?
![]() |
TYPES OF DATA IN PYTHON |
Now attention! How does a computer understand which sequence of ones and zeros is for a video file and which is for an audio one? Which is text and which is numbers? No way! It can't define a chain of zeros and ones as anything other than a chain of zeros and ones. Looks like a tautology, but that's true. "I'm a simple machine: I saw zeros and ones - I perceived it as zeros and ones".
In confidence, the processor doesn't understand a lot. It is important for it to receive bits (zeros and ones as we said), to process them by its own rules and to do nothing else.
So how to explain that 1000001 is the number 65, and not the symbol "A" and not the number one million one? And who will explain?
The Easter egg for programmers
To start, we’ll learn just three types of data:
Memorize them, memorize by all means! And then learn by heart.
![]() |
CLASSIFICATION OF LANGUAGES |
There are low-level programming languages. There are high-level ones. The difference is that high-level languages use ready-made commands instead of routine, often implemented operations. For example, the print() function, which kindly displays the necessary information on the screen, will consist of 4-6 lines in the low-level Assembly language (it depends on different conditions). And there is only one line for this in Python. Feel the difference.
![]() |
|
The high-level languages do routine work for us. On the one hand, it's good because you don't have to waste time writing additional code. On the other hand, it’s bad - there is no full control over the program. On the third hand, it’s also good because it is almost impossible to write a program in a high-level programming language that can break a computer paralyze the operating system work.
We can buy a bar of soap in the store and wash all clothes with it. It will take a long time, will be partly unpleasant and even funny sometimes. But we would wash every spot, every dot. We would control the entire washing process from start to finish. Soap is a low-level washing.
But you can take care of yourself and buy an expensive massive washing machine. Then put clothes inside it, add some laundry detergent and let it snow wash. After finishing just reap the result. And what is happening inside the machine and in which direction is spinning - we do not care at all. Just to make clothes clean! A washing machine is a high-level washing.
Again, we can't clearly answer the question clearly. Which programming languages are better: high- or low-level ones? Each language is used for certain situations. For example, it is better to program devices in Assembler. It requires a little memory, over which the programmer gets full control and works directly with the processor.
Interactive features for sites, all sorts of chat rooms, forums and social networks are for PHP. Or Python.
If you want to write your own Counter-Strike with blackjack and bots, learn C, C++, C# and, to start, the Unity engine.
Yes, you've heard correctly. Each language has its own specialization. But having studied one language, you can easily switch to any other. Don't worry about it. Especially in the modern world, Python is quite relevant due to its plugins (libraries). But that's another story. Focus on learning Python, and everything will work itself out.
![]() |
STRONG AND WEAK TYPING |
Python is a high-level programming language with one interesting feature. While data is received by the program, the interpreter itself determines what kind of data it belongs to. That is, whether it is a string, a number, or a logic variable. We almost don't need to think: as soon as we input data, Python sets a data type by itself.
In other languages, it's a little different. As soon as we enter data into the program, we should mark the data type in the same place - string, short number, long number, integer or fractional number, boolean variable or hyperlink.
This interesting feature of Python is called weak typing.
![]() |
|
Nevertheless, we must definitely get to know the data types better. So, what do we have?
![]() |
str |
The text data type is responsible for storing and processing only text data (thanks, Cap). Text data is any data expressed with the characters which a computer can identify. They include, first of all, alphabet symbols: A..Z, a..z, (and any other alphabet symbols of your native language) numbers 0..9, punctuation, special characters and anything included in the encoding table.
An encoding table is a special table in which each character has its own code. Codes are unique, and any character is identified primarily by the code.
The full version of the encoding table can be found through search engines. I present you a part of it. It contains the first 11 capital letters of the English and Russian alphabet and their codes:
Character A, code 65 Character А, code 1105
Character B, code 66 Character Б, code 1106
Character C, code 67 Character В, code 1107
Character D, code 68 Character Г, code 1108
Character E, code 69 Character Д, code 1109
Character F, code 70 Character Е, code 1110
Character G, code 71 Character Ж, code 1111
Character H, code 72 Character З, code 1112
Character I, code 73 Character И, code 1113
Character J, code 74 Character Й, code 1114
Character K, code 75 Character К, code 1115
There are global standards for encoding tables. Therefore, we can be sure that the characters displayed on our device will also be displayed on other devices in the same way.
![]() |
Even more. The character "А" (in English) and the character "А" (in Russian) are completely different for a computer too, despite the fact they are absolutely identical in style! |
The text data must be put in quotation marks. They could be double:
"This is text data"
or single:
'This is also text data'
The main thing is that the opening and the closing quotes must be the same. "text here" or 'text here' (and there is no other way).
Now, here is question for you. Is it text data or not?
"3.14"
Answer
The text data type supports the following operations:
If we decide to divide (/) or to subtract (-) lines and lines or lines and numbers, we'll receive the error, eventually. Try to write in Python Shell:
"New Year" / 2
Press Enter. Explore the result.
![]() |
int |
The integer data type is for integer numbers (easy). The size of processed data directly depends on available RAM of a computer.
The integer data type supports the following operations:
/ + - |
10 / 3 10 + 3 10 - 3 |
3.33 13 7 |
|
) |
Don't forget! int works only with positive, negative whole numbers (and with zero too).
![]() |
bool |
This is the most interesting data type. It takes one of two logic values: True or False. Only True, only False, and the values are written with a capital letter. Take into account.
Usually, the result of the logical expression, made with comparison operators, is placed in a logical variable.
You entered the room and was asked, "Is the light on?". You could answer this question with “Yes” (True) or “No” (False), and your binary answer is easily described with a boolean variable.
The dialogue may look like this:
- Is the light on?
- True!
What happened right now? You were asked a question, you analyzed the situation, looked at a chandelier or a lamp, compared it with the one turned off and realized that the light is currently on.
The key word is compared. A computer also compares. It compares data, not the light bulbs. The result of the comparison is just a value of a logical type. Either True or False.
![]() |
|
Using the following operators you can compare data. Practice in Python Shell. Write, for example, 5 > 5. Press Enter and look at the result.
"A" > "B" |
False |
||
"A" < "B" |
True |
||
"C" >= "E" |
False |
||
"C" <= "C" |
True |
||
"Z" != "Z" |
False |
||
"Z" == "Z" |
True |
The value True is also considered as 1, and False as 0.
Try this:
3 / True
The result: 3.0
3 / False
The result: "ZeroDivisionError: division by zero".
![]() |
|
![]() |
SUMMARY |
Python has slightly more data types than those considered here. But we do not need to rush into battle and learn everything. Firstly, you need to understand the basic principles and processing mechanisms of the types presented here; we’ll have time to study, do not hurry. Already much can be done with only a string, an integer and a logical (true/false) data type.
To the string (text, character) data we can apply two operations:
To the integer data type we can apply the following operations:
To the logical result we have the right to apply (is not prohibited by law) the following operations:
Breathe out! You don't have to learn it. As you progress and as you practice, these operations and rules will be applied by you intuitively. You don't think how to write addition sign in the entry "3 + 5", do you? So everything will be fine.
Now just remember where to get the information: in the chapter "Data Types". Maybe you’ll have to come here more often than expected!
© 2019-2023 Viktor Trofimov |