On 7/23/07, Bob Gailer [EMAIL PROTECTED] wrote:
A correction to the code at the end. The test of self.total_num_of_items
should precede the pop(0)
Bob, I spent today studying what you've been telling me and I put the
finishing touches to make your code pass my battery of tests. It still is
On 7/23/07, Alan Gauld [EMAIL PROTECTED] wrote:
The prime directive of coding is make it readable!
The DRY principle is just that a principle. If repeating makes for
more maintainable or readable code then repeat yourself.
Remember 80% of the cost of software is in maintenance not initial
[EMAIL PROTECTED] wrote:
On 7/23/07, *Bob Gailer* [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
A correction to the code at the end. The test of
self.total_num_of_items
should precede the pop(0)
Bob, I spent today studying what you've been telling me and I put the
assert create_table(5, 3) == [(0, 1, 2), (3, 4)]
AssertionError
I know that my method of calculating the number of rows is faulty,
but I'm not sure how to correct it.
num_rows = (num_items/row_size) + (num_items%row_size)
This uses integer division then adds the remainder, so for
[EMAIL PROTECTED] wrote:
On 7/23/07, *Bob Gailer* [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
A correction to the code at the end. The test of
self.total_num_of_items
should precede the pop(0)
Bob, I spent today studying what you've been telling me and I put the
On 7/20/07, Bob Gailer [EMAIL PROTECTED] wrote:
Take advantage of slicing:
def create_grid(self):
table = []
for i in range(0, len(self.total_num_of_items),
self.max_num_of_items_per_row):
table.append(tuple(self.total_num_of_items[i : i +
[EMAIL PROTECTED] wrote
one part where I believe I violate the prime directive of coding,
which is
not to repeat yourself:
The prime directive of coding is make it readable!
The DRY principle is just that a principle. If repeating makes for
more maintainable or readable code then repeat
[EMAIL PROTECTED] wrote:
On 7/20/07, *Bob Gailer* [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
Take advantage of slicing:
def create_grid(self):
table = []
for i in range(0, len( self.total_num_of_items),
self.max_num_of_items_per_row):
A correction to the code at the end. The test of self.total_num_of_items
should precede the pop(0)
[EMAIL PROTECTED] wrote:
On 7/20/07, *Bob Gailer* [EMAIL PROTECTED]
mailto:[EMAIL PROTECTED] wrote:
Take advantage of slicing:
def create_grid(self):
table = []
dear fellow Python enthusiasts:
in the last year I have been experimenting with Python, and I set out to
create a function that, given a number of items and a maximum number of
items per row, would generate a table of rows of items. However, there is
one part where I believe I violate the prime
[EMAIL PROTECTED] wrote:
dear fellow Python enthusiasts:
in the last year I have been experimenting with Python, and I set out
to create a function that, given a number of items and a maximum
number of items per row, would generate a table of rows of items.
However, there is one part
[EMAIL PROTECTED] wrote:
dear fellow Python enthusiasts:
in the last year I have been experimenting with Python, and I set out
to create a function that, given a number of items and a maximum
number of items per row, would generate a table of rows of items.
However, there is one part
[EMAIL PROTECTED] wrote:
dear fellow Python enthusiasts:
in the last year I have been experimenting with Python, and I set out
to create a function that, given a number of items and a maximum
number of items per row, would generate a table of rows of items.
However, there is one part
13 matches
Mail list logo