Question: Build a wages application in python based on this code: that will open the file payroll.txt, use a loop to read a list of employee

Build a wages application in python based on this code:

Build a wages application in python based on this code: that will

that will open the file payroll.txt, use a loop to read a list of employee names hours and wages into a multidimensional list, then use another loop to print out that list, with an additional element that shows the weekly pay.

Content in payroll.txt

Chris:Smith:20:15.75

Mary:Peters:40:18.00

Mike:Jones:35:12.50

Ann:Roberts:25:10.75

John:King:25:15.75

Ken:Stewart:32:12.50

Joan:Silvers:20:12.50

Karen:King:30:12.50

How to read a file into a multidimensional list fh open ("payroll. txt", "r") #we open the file payTable = [] #we create an empty list called payTable for myRecord in fh: the strip each record to get rid of newlines myRecordmyRecord.rstrip("rln") #we split each record payTable.append (myRecord. split (". ")) Note that we are appending the entire record as one element of the list fh.close() #we close the file print(payTable) 'Chris' 'Smith', "20,'15.75', ['MaryPeters,'40,18.00'], ['Mike Jones'35 12.50'1, 'Ann 'Roberts,25,10.75', 'John', 'King', '25 '15.75', 'Ken'Stewart,'32 '12.50'1, I'JoanSilvers','2012.50 , 'Karen,'King, '30, '12.50'11

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!