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.
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")
Step by Step Solution
There are 3 Steps involved in it
To turn your table function into a table object with the requested features you can follow ... View full answer
Get step-by-step solutions from verified subject matter experts
