Re: [Tutor] computer basics

2009-12-29 Thread GilJohnson
Richard Hultgren yahoo.com> writes: > I am learning Python slowly.  I would like to begin learning all about how > computers work from the bottom up.  I have an understanding of binary code. > Where should I go from here; can you suggest continued reading, on line or > off to continue my educatio

Re: [Tutor] Error writing to file...

2009-12-25 Thread GilJohnson
Ken G. insightbb.com> writes: > [...] > Do I need to convert a numeric random number to a string number? > [...] Yes, as long as you open the file as "w" you need to use "repr()" [repr(int)]. If you want to save the integer, you need to open a file as "wb", write binary. Check your documentation

Re: [Tutor] working with bit arrays

2009-12-03 Thread GilJohnson
Dave Angel ieee.org> writes: > Once you have an *array* of integers, you have much more than 32 bits to > work with. For example, with an array of size 10, you now have 320 bits > to work with. He's just pointing out that it's a little bit awkward to > address a group of bits that are not al

Re: [Tutor] working with bit arrays

2009-12-02 Thread GilJohnson
As`Kent Johnson pointed out, you don't need to convert anything to strings, etc. An integer _is_ a bit array, and individual bits can be tested using the bitwise operators. For your example, if A is an integer you can test bit 8 with: if A & (1 << 8): dosomething There is a simple example on the Py