Python DSA Notes Flashcards

1
Q

Difference between any and all in python

A

all([0,0,0,1]) will return False
all([0,0,0,0]) will return False
all([0,0,0,1]) will return True
all([0,0,0,0]) will return False

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

Rules of binary addition.

A

Rule 1: 0 + 0 = 0 ; Carry 0.
Rule 2: 0 + 1 = 1 ; Carry 0.
Rule 3: 1 + 0 = 1 ; Carry 0.
Rule 4: 1 + 1 = 0 ; Carry 1.
Rule 5: 1+1+1=1; Carry 1.

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

what does % and // means in python.
tell 3%2 and 3//2

A

3%2 means - when we divide 3 by 2 what is the remainder here it will be 1.

3//2 means - when

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