Data type
English is called Data Types
Types mean types
Data Types are translated into data types
In the world of Python
Not just Python
All major programming languages are common
We all have 4 key types
The first is calledInteger Englishinteger
Integer it can be abbreviated aslnt
X equals 5 X equals 10 X equals 1000
Y equals 2 Y equals 1000
These are integers
The second kind is calledFloating point
It is actuallyDecimalthe meaning of
For example, 1.1 0.1 3.14 are decimals
Its English name isfloat
Try your best
Memorize these English words
Quite important because there are only 4 kinds
lntIs an integer
floatFloating point
There is no shorthand for float
The third isBollinger value
EnglishbooleanIts shorthand is calledbool
We haven't seen this Bollinger value
Bollinger can only be equal to two things
One is calledTrue One is calledFalse
Only these two things True and False
It is Bollinger
So it follows
Integer and floating point are not the same
We can play freely with integers and floating-point numbers
There are unlimited possibilities 5 10 1000 0
This is an integer
What about floating point numbers? 0.1 9.9 are all floating point numbers
Bollinger values are different
Bollinger can only be equal to two
True and False
True is really true
False is false or wrong
The fourth one is calledString
EnglishstringReferred to asstr
What is a string
Let's look at an example directly
For example, Allen is a string
This is my name English name Allen
What about Allen?
There is no way to use numbers
I ca n’t use integers, nor can I use floating-point numbers
Then it is not Bollinger
So you can imagine
The string is the part of all text
You can think of it as text
The best understood word should be called text
OK, Allen is a string
What are the characteristics of the string
It has this symbol one on and one off
There is this symbol when open
At the end there is this symbol
This is calledapostrophe
Is the key to the left of Enter
You can take a look at your keyboard
Enter the single quote on the left of the key
You have to enclose it with single quotes
Box at the beginning and end
It will automatically become a string
Then inside this single quote
Can hold anything like me
I can play freely like this
I can also put spaces in it, like me
This is also a string
My paragraph is also a string
I do n’t even have anything inside
Single quotation marks start Single quotation marks end
This is also a string is an empty string
We make it an empty string
Then you can beat me inside
I can continue to play the space
So there is a lot of room for this free play of strings
You just use it
We are a string with this ending
We at the beginning and the end are strings
OK, I'll delete these examples first
I deleted some of my code
Now we know that there are 4 kinds of things
Let's give some examples
Let's declare 4 variables
Create when you declare
Let's declare 4 variables
Okay now we know
The programming language has these 4 data types
Let's give a few examples
Let's declare 4 variables
Declaring 4 variables means creating 4 variables
For the first one, we use integers
We declare that something is an integer
For example, the name of the price price variable
My name is price
How much is Maixiang milk tea 10 yuan
It ’s an integer, so price is equal to 10.
That price is an integer belonging to the first category
So what is floating point?
The ballpoint pen
Do you know the pen width 0.38
There is 0.38 like 0.45
The thickness of
Then I write a pen equal to 0.38
Because it's a decimal
So it's just a float
Third Bollinger
When is it used black and white
I will give you an example of what is wrong
Is it raining today
The answer is yes or no
Yes, yes, yes, true
Then suppose we like naming
Something called rain
Did it rain
We call it true
Then there is rain, right?
Rain equals true
So rain is a Boolean value
4th string name
My name Allen is like a string
You must be very careful
When you invented it
When you type
This symbol must be a string
When many people started writing
Would want to use a string
But I forgot to write this symbol
You see if i didn't write this symbol
If I didn't type single quotes
It will become white
Our string is in Sublime
Should be yellow
What about Sublime?
Sublime will automatically turn the string into yellow
So any yellow part we know is a string
Then I put these because these are not code
I will delete it first
Then I archive
After that, we will practice printing by the way
I printed these out
print pen print rain print name
Good archive remember
Go back to CMD and press
The last command I used
I press enter
All printed
10 0.38 true Allen
So I have now demonstrated 4 data types
They are all created separately
By the way, mention this print function
It can print what you want to print
We can print many at once
Just use commas to separate
For example like this
I threw it all into the same print
I use commas to separate, then I do n’t need these
This means printing the price first
Reprint the pen and reprint the rain
It is very simple to print the name
Just remember to separate with commas
Then look at me, there is a space after my comma
This is a better way to write
No yes or no
But it ’s better to have a guide
Good writing is a guide
I will talk about the second day
OK then we archive now
To execute
It's all printed on the same line
So I used only one print
All these variables
Now the above 4 variables are all printed