Python operators are similar to other languages (we only know the basic usage of these operators for the time being, so that we can expand the following content. advanced applications are not introduced for the time being) mathematical operations & amp; amp; gt; & amp; gt; print1 + 9 Python operators are similar to those in other languages.
(Currently, we only know the basic usage of these operators, so that we can expand the following content. advanced applications are not introduced at the moment)
Mathematical operations
>>> Print 1 + 9 # addition >>> print 1.3-4 # subtraction >>>> print 3*5 # multiplication >>> print 4.5/1.5 # division >>> print 3 ** 2 # multiplication party> print 10% 3 # Calculate the remainder
Judgment
Returns True/False if it is True or False.
>>> Print 5 = 6 #=, equal >>> print 8.0! = 8.0 #! =, Range> print 3 <3, 3 <= 3 # <, less than; <=, less than or equal to> print 4> 5, 4> = 0 #>, greater than; >=, greater than or equal to >>> print 5 in [, 5] #5 is an element of list [, 5]
(There are also is, is not, and so on, not in-depth)
Logical operation
Operation between True and False
>>> Print True and True, True and False # and, "and" operations, both of which are True >>> print True or False # or, "or" operations, one of them is True, that is, True> print not True # not, "not" operation, take the inverse
It can be used with the previous part to do some exercises, such:
>>>print 5==6 or 3>=3
Summary
Mathematics +,-, *,/, **, %
Judgment = ,! =,>,> =, <, <=, In
Logic and, or, not