Answered step by step
Verified Expert Solution
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
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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started