Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Python class definition for class Worksheet for the simple spreadsheet objects (worksheets) described below. A worksheet is a two-dimensional arrangement of cells, each

Write a Python class definition for class Worksheet for the simple spreadsheet objects (worksheets) described below. A worksheet is a two-dimensional arrangement of cells, each of which contains a simple value (string, integer or float). The columns are indexed using letters (A, B, and so on at most 26!) while the rows are indexed numerically beginning at one. Each cell has a label of the form B3 consisting of its column letter and its row number. The initializing method takes two parameters: a name for the worksheet (string) and a number (integer) representing the number of columns. Initially the worksheet contains zero rows; rows can be appended later (see below). The class definition should make the dimensions of the worksheet w accessible using w.max row and w.max column (the number of rows and columns, respectively), and should include implementations for the following methods: w.read cell(label) Return the value in the cell denoted by the string label. Ignore the possibility of there being no cell with that label. w.write cell(label, newval) Replace the value in the cell denoted by the string label with the value of parameter newval. Return the old value from that cell. Ignore the possibility of there being no cell with that label. w.append(self, newvals) Append a new row at the end of this worksheet i.e. beneath all the existing rows. Parameter newvals is a list and is optional. If newvals is provided, use its values to populate the cells of the new row left to right. If newvals is not provided, the cells in the new row are populated with the value None. w.show() Print out the contents of the worksheet. Use the example at the bottom of the page as a guide for how the output should be formatted.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Introduction To Constraint Databases

Authors: Peter Revesz

1st Edition

1441931554, 978-1441931559

More Books

Students also viewed these Databases questions

Question

List the components of the strategic management process. page 72

Answered: 1 week ago