Home >Backend Development >Python Tutorial >10 knowledge points that Python beginners must understand
10 useful information every day, welcome to follow!
Python famous saying: Even if I am not a programmer, I still have to learn Python! How domineering, the importance can be imagined. Let’s briefly talk about what can you do after learning Python?
Answer: You can engage in web development, scientific computing and statistics, artificial intelligence, education, desktop interface development, software development, back-end development, etc. With the rise of AI, artificial intelligence and children's programming, you will inevitably It is only a matter of time before Python is pushed to an important position, surpassing Java and C.
Next, I will list the different syntax points between Python and (PHP and Java) to make it easier for everyone to learn!
1. Splicing is separated by "," commas instead of . You can also use numbers:
Note: It is different from PHP. PHP uses ., remember!
2. There are many references to the package:
Note: Python’s packages and modules are more complete and complete than Java’s , personal opinion!
3. Usage of arithmetic operator //: (divisible, regardless of decimal point or integer)
4. Use ** for power operation:
##5. Logical operators: and or not Both of these writing methods are acceptable;Note: It is recommended that you use a>=80 and a
6. Interesting ternary operator: 7. Use of assertion assert:##If the input is assert 3>4, an error will be reported;
8. For loop writing method:
Explanation:range([start,] stop[,step=1])
The above example: range(1,10) cannot get the value of 10; remember
9, list Traversal and addition:
If you want to continue adding, you can use the append() method. This method can only add one, not multiple;
Note: The above two are added to the end; next we will jump in line; lists have subscripts like arrays, starting from 0; this is very important!Use the insert (list position, inserted value) method
10. Deletion of the list:
There are three main reasons here Methods:
(1) remove() method: cannot be deleted by subscript;
(2) del() method: deleted by subscript ;
(3) pop() method: The last element of the list is popped by default, but it can also be popped by subscript;
All the sequences are customized according to the Python learning route, and there are also some comparisons with Java and PHP. Python videos will be released later. Welcome to pay attention to the PHP Chinese website!
The above is the detailed content of 10 knowledge points that Python beginners must understand. For more information, please follow other related articles on the PHP Chinese website!