#给a赋值100. Judge A then produce a different output followed by a colon, not a semicolon, English is not Chinese. A = 100if a >= 50:print (a) else:print (-a)
A statement that begins with a # is a comment that is visible to the person and can be anything, and the interpreter ignores the comment. Each of the other lines is a statement that, when the statement ends with a colon:, the indented statement is treated as a block of code. Indentation has pros and cons. The advantage is that you are forced to write the formatted code, but there is no rule that indents are a few spaces or tabs. In accordance with established management, you should always stick to the indentation of 4 spaces. Another benefit of indenting is forcing you to write less indented code, and you tend to split a very long piece of code into several functions, resulting in less code being indented. The downside of indentation is that the "copy-paste" function fails, which is the most pit-daddy place. When you refactor the code, the pasted past code must re-check that the indentation is correct. In addition, it is difficult for the IDE to format Python code just like formatted Java code. Finally, it is important to note that the Python program is case-sensitive, and if the case is written incorrectly, the program will give an error. Python uses indentation to organize blocks of code, so be sure to follow the customary conventions and stick to the indentation of 4 spaces. In the text editor, you need to set the tab to automatically convert to 4 spaces, making sure you don't mix tabs and spaces.
This article is from the "love to Learn bear children" blog, please be sure to keep this source http://molilinzi.blog.51cto.com/8282931/1703858
Python Learning notes-Foundation Consolidation