Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 5126

Python • Re: boolean conversion problem

$
0
0
Try this ...

Code:

a = 10# 0b1010print(a)print()print((a >> 0) & 1)print((a >> 1) & 1)print((a >> 2) & 1)print((a >> 3) & 1)print()print(((a >> 0) & 1) == 1)print(((a >> 1) & 1) == 1)print(((a >> 2) & 1) == 1)print(((a >> 3) & 1) == 1)

Code:

100101FalseTrueFalseTrue

Statistics: Posted by hippy — Fri Dec 06, 2024 3:04 pm



Viewing all articles
Browse latest Browse all 5126

Trending Articles