<SYSTEM_TASK:>
Given the following text description, write Python code to implement the functionality described below step by step
<END_TASK>
<USER_TASK:>
Description:
 Explores ways of clearing a table,
from given starting point to end of line
and entire following lines.
Step1:  The above is what the output should look like.
Step2:  Now for some Python.
<ASSISTANT_TASK:>
Python Code:
%%script bash
# Ignore this boring cell.
# It allows one to do C in Jupyter notebook.
cat >20170706_head.c <<EOF
#include <stdlib.h>
#include <stdio.h>
#define LINES (3)
#define COLUMNS (4)
void print_buf(char buf[LINES][COLUMNS])
{
    for (int row = 0; row < LINES; row++) {
        for (int column = 0; column < COLUMNS; column++)
            putchar(buf[row][column]);
        putchar('\n');
    }
}
EOF
cat >20170706_tail.c <<EOF
int main(int argc, char *argv())
{
    char buf[LINES][COLUMNS];
    
    for (int row = 0; row < LINES; row++)
        for (int column = 0; column < COLUMNS; column++)
            buf[row][column] = '@';
    blank(buf, 1, 2);
    print_buf(buf);
}
EOF
program_name="${PATH%%:*}/20170706_c_foo"
echo $program_name
cat >"$program_name" <<EOF
#!/usr/bin/env sh
cat 20170706_head.c >20170706_blank.c
cat >>20170706_blank.c
cat 20170706_tail.c >>20170706_blank.c
cc     20170706_blank.c   -o 20170706_blank
./20170706_blank | tr ' ' '.'
EOF
chmod +x "$program_name"
%%script 20170706_c_foo
void blank(char buf[LINES][COLUMNS], int row, int column)
{
    goto MIDDLE;
    for ( ; row < LINES; row++)
        for (column = 0; column < COLUMNS; column++)
            MIDDLE: buf[row][column] = ' ';
}
Explanation: Explores ways of clearing a table,
from given starting point to end of line
and entire following lines.
End of explanation
%%script 20170706_c_foo
void blank(char buf[LINES][COLUMNS], int row, int column)
{
    for ( ; row < LINES; row++) {
        for ( ; column < COLUMNS; column++)
            buf[row][column] = ' ';
        column = 0;
    }
}
%%script 20170706_c_foo
void blank_to_end_of_row(char buf[LINES][COLUMNS], int row, int column)
{
    for ( ;column < COLUMNS; column++)
        buf[row][column] = ' ';
}
void blank_row(char buf[LINES][COLUMNS], int row)
{
    blank_to_end_of_row(buf, row, 0);
}
void blank(char buf[LINES][COLUMNS], int row, int column)
{
    blank_to_end_of_row(buf, row++, column);
    for ( ; row < LINES; row++)
        blank_row(buf, row);
}
%%script 20170706_c_foo
void blank_to_end_of_row(char buf[LINES][COLUMNS], int row, int column)
{
    for ( ;column < COLUMNS; column++)
        buf[row][column] = ' ';
}
void blank(char buf[LINES][COLUMNS], int row, int column)
{
    blank_to_end_of_row(buf, row++, column);
    for ( ; row < LINES; row++)
        blank_to_end_of_row(buf, row, 0);
}
Explanation: The above is what the output should look like.
End of explanation
LINES = 3
COLUMNS = 4
def foo(row=1, column=2):
    buf = [
        ['@' for _ in range(COLUMNS)]
        for _ in range(LINES)
    ]
    blank(buf, row, column)
    for row in buf:
        print(''.join(row).replace(' ', '.'))
def blank(buf, row, column):
    for row in range(row, LINES):
        for column in range(column, COLUMNS):
            buf[row][column] = ' '
        column = 0
foo()
def blank_to_end_of_row(buf, row, column):
    for column in range(column, COLUMNS):
        buf[row][column] = ' '
def blank_row(buf, row):
    blank_to_end_of_row(buf, row, 0)
def blank(buf, row, column):
    blank_to_end_of_row(buf, row, column)
    row += 1
    for row in range(row, LINES):
        blank_row(buf, row)
foo()
def blank_to_end_of_row(buf, row, column):
    for column in range(column, COLUMNS):
        buf[row][column] = ' '
def blank(buf, row, column):
    blank_to_end_of_row(buf, row, column)
    row += 1
    for row in range(row, LINES):
        blank_to_end_of_row(buf, row, 0)
foo()
%%script 20170706_c_foo
/* this is wrong: fails to clear beginning of following lines */
int blank(char buf[LINES][COLUMNS], int row_arg, int column_arg)
{
    int row;
    int column;
    for (row = row_arg; row < LINES; row++)
        for (column = column_arg; column < COLUMNS; column++)
            buf[row][column] = ' ';
}
Explanation: Now for some Python.
End of explanation
<END_TASK>