Write a function print contents(data table) that takes a nested list of data and prints its contents as specified below. Notes: • data table is a list of lists with any number of rows or columns. • For each row, print "Row (row_number) contents:" where (row number) is the row's number (starting from 0). • For each column within a row, print - Column (column_number): (contents of column)" where (column_number) is the column's number (starting from 0) and (contents of_column) is the data contained within that column of that row. Note the single space at the start. For example: Test Result two_by_four - [1, 2], [3, 4], [5, 6), [7, 8] Row e contents: Column e: 1 Column 1: 2 Row 1 contents: Column e: 3 Column 1: 4 Row 2 contents: Column e: 5 Column 1: 6 print_contents(two_by_four) Row 3 contents: Column e: 7 Column 1: 8 Row e contents: magic_square- [2, 7, 6], [9, 5, 1], [4, 3, 8] Column e: 2 Column 1: 7 Column 2: 6 Row 1 contents: print contents(magic_square) Column e: 9 Column 1: 5 Column 2: 1 Row 2 contents: Column e: 4 Column 1: 3 Column 2: 8
Write a function print contents(data table) that takes a nested list of data and prints its contents as specified below. Notes: • data table is a list of lists with any number of rows or columns. • For each row, print "Row (row_number) contents:" where (row number) is the row's number (starting from 0). • For each column within a row, print - Column (column_number): (contents of column)" where (column_number) is the column's number (starting from 0) and (contents of_column) is the data contained within that column of that row. Note the single space at the start. For example: Test Result two_by_four - [1, 2], [3, 4], [5, 6), [7, 8] Row e contents: Column e: 1 Column 1: 2 Row 1 contents: Column e: 3 Column 1: 4 Row 2 contents: Column e: 5 Column 1: 6 print_contents(two_by_four) Row 3 contents: Column e: 7 Column 1: 8 Row e contents: magic_square- [2, 7, 6], [9, 5, 1], [4, 3, 8] Column e: 2 Column 1: 7 Column 2: 6 Row 1 contents: print contents(magic_square) Column e: 9 Column 1: 5 Column 2: 1 Row 2 contents: Column e: 4 Column 1: 3 Column 2: 8
Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
Related questions
Question
What I've done so far but seems wrong.
row_number=0
column_number=0
for i in range(len(data_table)):
print(f"Row {row_number} contents:")
row_number += 1
for j in range(0, len(data_table[i])):
column_number += 1
print(f" Column {j}: {column_number} ")
![Write a function print contents(data table) that takes a nested list of data and prints its contents as specified below.
Notes:
• data table is a list of lists with any number of rows or columns.
• For each row, print "Row {row number) contents:" where (row_number} is the row's number (starting from 0).
• For each column within a row, print - Column (column_number): (contents of_column)" where (column_number) is the column's number (starting from 0)
and (contents of column} is the data contained within that column of that row. Note the single space at the start.
For example:
Test
Result
two_by_four - [
Row e contents:
[1, 2],
[3, 4],
[5, 6],
Column e: 1
Column 1: 2
Row 1 contents:
[7, 8]
Column e: 3
Column 1: 4
print_contents(two_by_four)
Row 2 contents:
Column e: 5
Column 1: 6
Row 3 contents:
Column e: 7
Column 1: 8
magic_square- (
[2, 7, 6],
[9, 5, 1],
Row e contents:
Column e: 2
Column 1: 7
[4, 3, 8]
Column 2: 6
Row 1 contents:
Column e: 9
print contents (magic_square)
Column 1: 5
Column 2: 1
Row 2 contents:
Column e: 4
Column 1: 3
Column 2: 8](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2F2f38207c-a65c-4294-8d77-eb45b88b09e4%2F327c751a-90c8-446e-a6a4-ae2ca017b6d2%2Fc3rbcss_processed.jpeg&w=3840&q=75)
Transcribed Image Text:Write a function print contents(data table) that takes a nested list of data and prints its contents as specified below.
Notes:
• data table is a list of lists with any number of rows or columns.
• For each row, print "Row {row number) contents:" where (row_number} is the row's number (starting from 0).
• For each column within a row, print - Column (column_number): (contents of_column)" where (column_number) is the column's number (starting from 0)
and (contents of column} is the data contained within that column of that row. Note the single space at the start.
For example:
Test
Result
two_by_four - [
Row e contents:
[1, 2],
[3, 4],
[5, 6],
Column e: 1
Column 1: 2
Row 1 contents:
[7, 8]
Column e: 3
Column 1: 4
print_contents(two_by_four)
Row 2 contents:
Column e: 5
Column 1: 6
Row 3 contents:
Column e: 7
Column 1: 8
magic_square- (
[2, 7, 6],
[9, 5, 1],
Row e contents:
Column e: 2
Column 1: 7
[4, 3, 8]
Column 2: 6
Row 1 contents:
Column e: 9
print contents (magic_square)
Column 1: 5
Column 2: 1
Row 2 contents:
Column e: 4
Column 1: 3
Column 2: 8
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images

Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Recommended textbooks for you

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education

Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education