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

Python • Re: boolean conversion problem

$
0
0
Because d is a string?

Code:

a=5b=bin(a)print(b,type(b))c=b[-1:]d=b[-2:-1]e=b[-3:-2]print(c,bool(c))print(d,type(d),bool(int(d)))print(e,bool(e))

Statistics: Posted by rpiMike — Thu Dec 05, 2024 4:51 pm



Viewing all articles
Browse latest Browse all 4151

Trending Articles