Saltar al contenido

operación bit a bit en python para diferentes números ejemplo de código

Estate atento porque en este tutorial encontrarás el arreglo que buscas.Esta sección fue aprobado por nuestros expertos para asegurar la calidad y exactitud de nuestro contenido.

Ejemplo: operadores bit a bit de python

x << y
Returns x with the bits shifted to the left by y places (and new bits on the right-hand-side are zeros). This is the same as multiplying x by 2**y.
x >> y
Returns x with the bits shifted to the right by y places. This is the same as//'ing x by 2**y.
x & y
Does a "bitwise and". Each bit of the output is1if the corresponding bit of x AND of y is1, otherwise it's 0.
x | y
Does a "bitwise or". Each bit of the output is0if the corresponding bit of x AND of y is0, otherwise it's 1.~ x
Returns the complement of x - the number you get by switching each 1for a 0and each 0for a 1. This is the same as-x -1.
x ^ y
Does a "bitwise exclusive or". Each bit of the output is the same as the corresponding bit in x if that bit in y is0,and it's the complement of the bit in x if that bit in y is1.

¡Haz clic para puntuar esta entrada!
(Votos: 0 Promedio: 0)



Utiliza Nuestro Buscador

Deja una respuesta

Tu dirección de correo electrónico no será publicada. Los campos obligatorios están marcados con *