What python comments and operators look like
Python comments and operators are like, I believe that many inexperienced people do not know what to do, so this article summarizes the causes of the problem and solutions, through this article I hope you can solve this problem.
1. Multi-file project walkthrough
Create two python files under day02
Click on a file and right-click to run it. A file box will appear in the upper right corner.
Run the second file, and the steps are the same
Delete output box contents
two。 Comments (the interpreter will not interpret the content on the right side of #) 2.1 single-line comments (line comments)
# followed by a space, there will be no grammatical errors
# this is the first comment print ("hello world") # this is the second comment print ("cat")
In the comment on the right, there are two spaces between code and #
Print ("pig") # second single-line comment 2.2 Multiline comment (block comment) "" this is multiline comment "" 3. Arithmetic operator 3.1operator a = 21b = 10print (a + b) print (a-b) print (a * b) print (a / b) print (a% b) # remainder print (a * * b) # Power print (a / / b) # divisible
Extension: "string"
"-" * 10
3.2 priority
Multiply and divide first and then add and subtract
Sibling: from left to right
You can use () to adjust the calculation priority
Sort arithmetic operators from high to low precedence
Example:
C = 2d = 3e = 4print (dwindles c + d * e) print (dudes * (c + d) * e)
Output
After reading the above, have you mastered the methods of python annotations and operators? If you want to learn more skills or want to know more about it, you are welcome to follow the industry information channel, thank you for reading!