Bits (Python) Flashcards

1
Q

Quels sont les 6 opérations binaires en python ?

A

5&raquo_space; 4 # Décalage à droite

5

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Comment convertir un int en binaire en python ?

A

bin(x)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

À quoi sert la fonction bin() ?

A

Convertir un int en sa version binaire :

bin(x)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Comment convertir un nombre binaire en int en python ?

A

int( “1101011000101” , 2)

int( “0b1001110” , 2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

À quoi sert un deuxième argument dans la fonction int en python ?

A

À préciser la base du nombre qu’on lui donne pour faire une bonne convention.
int( “10101101” , 2)

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q
En binaire :
0 & 0 = ?
0 & 1 = ?
1 & 0 = ?
1 & 1 = ?
101 & 110 = ?
A
0 & 0 = 0
0 & 1 = 0
1 & 0 = 0
1 & 1 = 1
101 & 110 = 100
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

Combinaison de touche pour faire un | ?

A

alt-maj-L

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

Ça fait quel caractère alt-maj-L ?

A

|

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q
0 | 0 = ?
0 | 1 = ?
1 | 0 = ?
1 | 1 = ?
10101 | 00011 = ?
A
0 | 0 = 0
0 | 1 = 1 
1 | 0 = 1
1 | 1 = 1
10101 | 00011 = 10111
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q
0 ^ 0 = ?
0 ^ 1 = ?
1 ^ 0 = ?
1 ^ 1 = ?
11010110 ^ 11001010 = ?
A
0 ^ 0 = 0
0 ^ 1 = 1
1 ^ 0 = 1
1 ^ 1 = 0
11010110 ^ 11001010 = 00011100
How well did you know this?
1
Not at all
2
3
4
5
Perfectly