Home >Backend Development >Python Tutorial >10 knowledge points that Python beginners must understand

10 knowledge points that Python beginners must understand

rainbow
rainbowOriginal
2020-05-21 15:54:052634browse

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:

10 knowledge points that Python beginners must understand

Note: It is different from PHP. PHP uses ., remember!

2. There are many references to the package:

10 knowledge points that Python beginners must understand

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)

10 knowledge points that Python beginners must understand

4. Use ** for power operation:

10 knowledge points that Python beginners must understand

##5. Logical operators:

and or not Both of these writing methods are acceptable;

10 knowledge points that Python beginners must understand

Note: It is recommended that you use a>=80 and a

6. Interesting ternary operator:

10 knowledge points that Python beginners must understand

7. Use of assertion assert:

10 knowledge points that Python beginners must understand##If the input is assert 3>4, an error will be reported;

8. For loop writing method:

10 knowledge points that Python beginners must understand

Explanation:

range([start,] stop[,step=1])

The above example: range(1,10) cannot get the value of 10; remember

9, list Traversal and addition:

09_10 knowledge points that Python beginners must understand If you want to continue adding, you can use the append() method. This method can only add one, not multiple;

09_10 knowledge points that Python beginners must understand

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

09_10 knowledge points that Python beginners must understand10. Deletion of the list:

There are three main reasons here Methods:

(1) remove() method: cannot be deleted by subscript;

10_10 knowledge points that Python beginners must understand (2) del() method: deleted by subscript ;

10_10 knowledge points that Python beginners must understand (3) pop() method: The last element of the list is popped by default, but it can also be popped by subscript;

10_10 knowledge points that Python beginners must understandAll 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!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn