Question: 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

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

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!