In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >
Share
Shulou(Shulou.com)06/01 Report--
The editor today will show you how to learn the operator of python. The knowledge points in the article are introduced in great detail. Friends who feel helpful can browse the content of the article with the editor, hoping to help more friends who want to solve this problem to find the answer to the problem. Follow the editor to learn more about "how to learn the operator of python".
1. Arithmetic operator
In a small example:
A = 5
B = 3
Small example of arithmetic operator description + plus a + b = 8-minus a-b = 2 * multiplied by a * b = 15 / divided by a / b = 1.666666666666666667 / divisible a / / b = 1% take the remainder a% b = 2 times * power a * * b = 125
Note:
(1) the integer becomes a floating point number (decimal) after division; (2) the integral division result only takes the integer part, and the decimal point and the following digits are deleted.
There are four situations in which the balance is taken:
1. Under normal circumstances, 5% 3 = 22, the divisor is negative-5% 3 = 1 calculation process: (- 2) + 3 = 1 minus sign before the remainder under normal circumstances Then add with the divisor to get the final result 3, the divisor is negative 5%-3 =-1 calculation process: 2 + (- 3) =-1 the remainder under normal circumstances Then add with the divisor to get the final result 4, the divisor and the divisor are both negative-5%-3 =-2 calculation process: add a negative sign before the remainder of the normal case, that is, the opposite of the remainder of the normal case 2, the comparison operator
The result of the comparison operator operation is a Boolean, True when the result is correct, and False when the result is wrong.
In a small example:
A = 1
B = 2
Comparison operator description small example > greater than a > b-- > FalseTrue > = greater than or equal to a > = b-- > False false = not equal to a! = b-- > True
Note:
> =, 3 and 3Trueor logic OR: all false is false One true is true 1 > 2 or 2Falsenot logic is not: contrary to the original value, not 2 > 1-> False instance a = 1b = 2c = Falseser1 = aaprint (ser1) # Trueser2 = a > b or b not > and > orres1 = True and (False or True) #-> True and Trueprint (res1) # Trueres2 = False or not True #-> False or False print (res2) # Falseres3 = False and True or False and True or False #-> False or False or Falseprint (res3) # False7, Bit operator bit operation is to convert data into binary value data first. And then do a series of calculations. The bitwise operator describes the bitwise operator & bitwise and / or bitwise non^ XOR > move right 11 bitwise non-bitwise non-operation, the result is: the absolute value of the original value plus one is | nroom1 | a = 6b =-6yoga = | 6room1 | = 7xOR = |-6fol1 | = 5 for bitwise XOR operations, if the binary values in the same position are the same, the result is 0, otherwise it is 1. 9 = 100110 = 10109 ^ 10 = 0011-- > 3 move the value to the right and move a few bits to the right, then the effective binary bit moves several bits to the right. It is equivalent to n > > m equals to the m power of n divisible 2. 9 = 10019 > > 1 = 0100-> 410 = 101010 > > 2 = 0010-> 2 shift the value of the operation to the left, if you move a few bits to the left, the effective binary bit will move several bits to the left. Equivalent to n or3, bitwise non-(~) > right shift (> >), left shift (bitwise XOR (^) > bitwise or (|) 1, multiplication, division > addition, minus 2, () > not > and > or3, bitwise non-(~) > right shift (> >), left shift (bitwise XOR (^) > bitwise or (|) unary operator: only one numeric operation at a time, for example: ~ 1 -12 binary operator: operating on only two numeric operations at a time For example: 5 + 31, unary operator precedence > binary operator 2, of all operators * * exponentiation has the highest priority 3, Among all operators, = assignment operator precedence lowest operator operator > bit operator > comparison operator > identity operator > member operator > logical operator > assignment operator summary (1) operator operator: +-* / /% * * (2) comparison operator: >
< >Thank you for reading, the above is the whole content of "how to learn the operator of python". Friends who learn it, hurry up and get started. I believe that the editor will certainly bring you better quality articles. Thank you for your support to the website!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.