CDA Data Analyst Produce
edit :Mika
Python The name of the variable
http://mpvideo.qpic.cn/
Hello everyone , This issue Python Tips , Let's talk about the naming of variables .
There are several rules you must pay attention to :
One 、 Do not start with a number .
You see, if it starts with a number , Running is wrong .
Two 、 There can be no spaces .
You see abc and 1 There must be no space between them , You must name it with at least one underline or horizontal line , Of course I recommend underlining .
3、 ... and 、 You cannot use built-in functions .
for instance print , It is a function of printing itself , Don't use it as a variable . After use , The printing function is gone .
Four 、 Keywords are not allowed .
image for Keywords such as... Cannot be used , Because it has been given the meaning it should have , Do you remember ?
Python To get the input
http://mpvideo.qpic.cn/
next , Let's talk about Python How to get the input content .
We use input This built-in function gets the input content .
You can see , So let's run this .
Enter the content you want to enter here , Write my name here david enter .
Now david This word has been copied to your name, So I'll put your name Print it out and have a look .
You see , david It shows here , therefore input Is a built-in method to get what you want to input .
Have you learned ?
Python And if loop
Hello everyone , stay Python There is a very important if Circulation requires us to master .
Let's talk about it today .
First of all, I have a x be equal to 10 , I'll write one first if x < 5, It would be print Age is less than 5 ,elif For if if If you're not satisfied , Next, continue to judge whether this is satisfied .
x Is it greater than or equal to 5 Less than 15 , If you are in this range, you will print Older than or equal to 5 Age less than 15 year .
Finally, if these two are not satisfied else ,print Older than 15 year .
Here we can have a look , If x be equal to 10, In this if The result of the loop is : Older than or equal to 5 Age less than 15 year .
If change to 20 , It will run with the result that it is older than 15 year .
This if Circulation is very important , Students need to master .