tee chwee liong wrote:
my IDLE seems to be giving me some funny error. i'm using Python 2.5 and Win XP. pls advise.
a=0b110010
SyntaxError: invalid syntax
Base two literals were only added to Python in version 2.6.
[steve@sylar ~]$ python2.6
...
>>> 0b111
7
In 2.5 and older, this is a
> Binary (leading with '0b'):
> >>> 0b1110 & 0b0110
> 6
>
> Good luck,
>
> -Martin
>
my IDLE seems to be giving me some funny error. i'm using Python 2.5 and Win
XP. pls advise.
>>> a=0b110010
SyntaxError: invalid syntax
>>> 0b1110 & 0b0110
SyntaxError: invalid syntax
>>> 0b10
SyntaxErr
On Mon, Feb 28, 2011 at 4:43 AM, Martin A. Brown wrote:
>
> : i'm confused with & and AND. for eg:
> : >>> 1110 & 0110
> : 64
> : >>> 1110 and 0110
> : 72
> :
> : i'm expecting if 1110 and with 0110 will get 0110 or 6.
> : pls advise.
>
> Above, python thinks you are representing one numbe
: i'm confused with & and AND. for eg:
: >>> 1110 & 0110
: 64
: >>> 1110 and 0110
: 72
:
: i'm expecting if 1110 and with 0110 will get 0110 or 6.
: pls advise.
Above, python thinks you are representing one number in decimal
notation and the other in octal.
Decimal (no leading zeroe
hi,
i'm confused with & and AND. for eg:
>>> 1110 & 0110
64
>>> 1110 and 0110
72
i'm expecting if 1110 and with 0110 will get 0110 or 6.
pls advise.
thanks
tcl
___
Tutor maillist - Tutor@python.org
To