Menu

(Solved) : 3 Implement Function Named Printcolumns Data Takes 1 Parameter Data List Contains Strings Q44101705 . . .

3. Implement a function named print_columns(data) that takes 1 parameter: a. data - a list contains strings, each string reprName Laaibah Arnold Sioned Shayaan Renee Cost Items 208.10 10 381.00 327.01 429.50 535.29 Name : left justified in 20 places

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. Show transcribed image text 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.

Expert Answer


Answer to 3. Implement a function named print_columns(data) that takes 1 parameter: a. data – a list contains strings, each string…

OR