Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

3. Implement a function named print_columns(data) that takes 1 parameter: a. data - a list contains strings, each string representing a data record Each record

image text in transcribedimage text in transcribed

3. Implement a function named print_columns(data) that takes 1 parameter: a. data - a list contains strings, each string representing a data record Each record represents a name, a price and a total number of items purchased as a single comma separated string. The exercise is to: a. split the record into its 3 parts b. convert the data where necessary (price should be a float and number of items an integer). c. print out the records formatted as below: Name Laaibah Arnold Sioned Shayaan Renee Cost Items 208.10 10 381.00 327.01 429.50 535.29 4 Name Laaibah Arnold Sioned Shayaan Renee Cost Items 208.10 10 381.00 327.01 429.50 535.29 Name : left justified in 20 places Cost: right justified in 6 place, 2 decimal places Items: right justified in 5 places Examples: >>> print_columns (sample_data) Name Cost Items Laaibah 208.10 10 Arnold 381.00 9 Sioned 327.01 Shayaan 429.50 Renee 535.29 Note The test data sample_data is in csc241-homework-3.py already

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions