Use the code below to add the following features to it: - Add features to the table
Fantastic news! We've Found the answer you've been seeking!
Question:
Use the code below to add the following features to it:
- Add features to the table function to turn it into a table object.
- Your table object should store properties like row_count, column_count, and border_size.
- Your table object should have methods like add_row() and delete_row().
- You should be able to create a table of arbitrary size by calling your object's constructor.
Code
def Table(rows, columns):
html_code = "
row_count = 1
while row_count <= rows:
html_code += ""
col_count = 1
while col_count <= columns:
html_code += ""
col_count += 1
html_code += ""
row_count += 1
html_code += "
" + input("Enter data for cell " + str(row_count) + "," + str(col_count) + ": ") + " |
return html_code
rows = int(input("How many rows: "))
columns = int(input("How many columns: "))
html_table = Table(rows, columns)
with open("index.html", "w") as f:
f.write(html_table)
import webbrowser
webbrowser.open("index.html")
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date: