Question: i have include my code only with some others infos, im not sure how to inport the data.txt to my actual code. The Payroll Department

i have include my code only with some others infos, im not sure how to inport the data.txt to my actual code.  i have include my code only with some others infos, im
not sure how to inport the data.txt to my actual code. The
Payroll Department keeps a list of employee information for each pay period
in a text file. The Write a program that inputs a filename

The Payroll Department keeps a list of employee information for each pay period in a text file. The Write a program that inputs a filename from the user and prints to the terminal a report of the wages paid to the employees for the given period. - The report should be in tabular format with the appropriate header. - Each line should contain: An employee's name - The hours worked The wages paid for that period. An example of the program input and output is shown below: Enter the file name: data.txt 1.Lambert3410.50Osborne226.25Giacometti5100.70 1. \# Put your code here 2 file=input ("Enter the file name: ") 3. try: with open(filename, ' I ') as infile: for line in infile: line=line.split() if len (1 ine )!=3 : continue name, rate, hours=1ine[0], float(1 ine[1]), int (1ine[2]) print(('\%-15s\%-10d\%-10.2f'). format(name, hours, total)) total=rateshours except: print('Error: could not find file: file) Enter the file name: datefu.txt Error: could not find file data.txt

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!