Summary: We know that in different languages, the results of negative number modulo operations may be different. For example, (-11) % 5 calculates 4 in Python and-1 in C (c99. Truncate division floor division in most programming languages, if the
This series of articles in the process of learning Python encountered a bottleneck, go to the Novice tutorial to experience the fun of Python, improve the overall knowledge framework. Enhance your understanding of the Python language and grasp the
Modulo and remainder, modulo RemainderFor integer a and B, the modulo or remainder operations are all performed: 1. evaluate the integer quotient: c = a/B; 2. modulus or remainder: r = a-c * B. the modulo operation and the remainder operation are
operator
Description
Example
Yield x
Generator function Send protocol
Lambda args:expression
Generating anonymous functions
X if y else Z
Ternary selection Expressions
This article is reproduced in: http://blog.sina.com.cn/s/blog_6f5c63ff0100tucb.html
We know that in different languages, the results of negative number modulo operations may be different. For example, (-11) % 5 calculates 4 in Python, whileThe
PythonoperatorThis section mainly describes the Python operators. To give a simple example 4 +5 = 9 . In the example,4 and 5 are called operands , and "+" is called an operator.The Python language supports the following types of operators:
Typically, modulo operations (MoD) and remainder (REM) operations are confused, because in most programming languages, the '% ' notation is used to represent modulo or remainder operations. Here we want to remind you to pay attention to the specific
Arithmetic operators
operator
Description
Example
+
Add-two Objects added
A + B output result 31
-
Minus-get negative numbers or one number minus the other
-b Output result-1
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.