Re: division by 7 efficiently ???

2007-02-02 Thread Garrick . Peterson
>How to divide a number by 7 efficiently without using - or / operator. >We can use the bit operators. I was thinking about bit shift operator >but I don't know the correct answer. It may not be efficient, but the easiest solution (without using tricks from a particular languages) is to increment

Re: stop script w/o exiting interpreter

2007-01-29 Thread Garrick . Peterson
> I want, and the script will stop executing at that line and will > return to the interactive interpreter, as I wish. May I recommend wrapping your main program in a function definition? Such as: main(): # Bulk of your code (use a macro to indent it faster) if __name__ == "__main__":