A brief explanation of Python syntax

Each language has its own grammar, whether it is natural language or our computer programming language, Python is no exception. The editor or parser converts the program code that conforms to the grammar into machine code that the CPU can execute, and then executes it .

Python’s syntax is relatively simple and uses indentation. Because I used to write mostly in JAVA or C, it is a bit unaccustomed to suddenly lose the braces and pay attention to indentation, but it is still acceptable. And to get into the habit of using 4 spaces for indentation, you can set Tab to automatically convert to 4 spaces in your text editor.

13d7734404914798f4b57598a67a1e8.pngThe statement starting with # is a comment, and each other line is a statement. When the statement ends with a colon:, the indented statement is regarded as a code block. It should be noted that Python programs are case-sensitive. If the wrong case is entered, the program will report an error.


Continuing Learning
||
submitReset Code
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!