+ 6

waht the << or >> in Python.

I still don't come to the lesson who teach this, so what it do? look at the code, this is returned 0 all the time. sorry if my English is not good.... https://code.sololearn.com/c0Q98Y55T8Bo/?ref=app

2nd Jul 2018, 8:42 PM
I -_- D
I -_- D - avatar
4 ответов
+ 7
These are bitwise operators. You can learn more about them here https://www.sololearn.com/learn/4086/?ref=app https://www.sololearn.com/learn/4087/?ref=app
2nd Jul 2018, 8:48 PM
Tim Thuma
Tim Thuma - avatar
+ 8
x<<n means duplicate x n times. x>>n means n times floor division of x by 2. Actually it is bitwise shifting but thats how to compute it.
2nd Jul 2018, 9:16 PM
Oma Falk
Oma Falk - avatar
+ 7
KrOW Tim Thuma thank you for now... I'll read the lessons
2nd Jul 2018, 9:06 PM
I -_- D
I -_- D - avatar
+ 3
>> and << are bit shift operator (if operators are integer). >> shift bits on right while << on left. Take 12 in base 2: 12= 1100 then: 12>>2 = 11(base 2)= 3 12<<2= 110000(base 2)= 48
2nd Jul 2018, 8:54 PM
KrOW
KrOW - avatar