subtree(users/wpcarro): docking briefcase at '24f5a642'
git-subtree-dir: users/wpcarro git-subtree-mainline:464bbcb15cgit-subtree-split:24f5a642afChange-Id: I6105b3762b79126b3488359c95978cadb3efa789
This commit is contained in:
commit
019f8fd211
766 changed files with 175420 additions and 0 deletions
19
users/wpcarro/scratch/facebook/utils.py
Normal file
19
users/wpcarro/scratch/facebook/utils.py
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
def init_table(rows=0, cols=0, default=None):
|
||||
table = []
|
||||
for row in range(rows):
|
||||
x = []
|
||||
for col in range(cols):
|
||||
x.append(default)
|
||||
table.append(x)
|
||||
return table
|
||||
|
||||
def get(table, row, col, default=0):
|
||||
if row < 0 or col < 0:
|
||||
return default
|
||||
return table[row][col]
|
||||
|
||||
def print_table(table):
|
||||
result = []
|
||||
for row in range(len(table)):
|
||||
result.append(' '.join([str(cell) for cell in table[row]]))
|
||||
print('\n'.join(result))
|
||||
Loading…
Add table
Add a link
Reference in a new issue