The 365 Data Science team is proud to invite you to our own community forum. A very well built system to support your queries, questions and give the chance to show your knowledge and help others in their path of becoming Data Science specialists.
Ask
Anybody can ask a question
Answer
Anybody can answer
Vote
The best answers are voted up and moderated by our team

Boolean expressions doubt

Boolean expressions doubt

0
Votes
1
Answer

If I write
x=3
y=5
print( x <<4 or y>>23)
Output: 48
How will be the output 48??

And print(x and y )

Output: 5 # how can be output 5?

1 Answer

365 Team
0
Votes

Hi Sai, 
thanks for reaching out!
The >> and << are what’s known as bitwise operators in Python. So x<<y will return x shifted to the left with y bits. And x >> y returns x shifted to the right by y bits.
If you’d like the boolean operators, they are single > or < , so (x < 4 and y>23) 
 
Best, 
Eli 

Thank you!

6 months
×
LAST CHANCE
Ready to Learn Data Science?
50% OFF