1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Anton [14]
3 years ago
14

The Payroll Department keeps a list of employee information for each pay period in a text file. The format of each line of the f

ile is the following: 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.
Computers and Technology
1 answer:
user100 [1]3 years ago
8 0

Answer:

import pandas as pd

filename = input("Enter file name with the extension included: ")

data = {}

with open("filename", "r") as file:

   content = file.readlines()

   for line in content:

       line_list = line.strip().split(" ")

       data[line_list[0]] = line_list[1] * line_list[2]

       del line_list

report = pd.DataFrame(list(data.items()), columns = ["lastname", "wages paid"])

print(report)

Explanation:

The python module prompts the user for the file name and opens the text file to extract the employee data with the python open function. It iterates over the file content and saves the last name and the wages paid to the employees ( the hours worked multiplied by the hourly rate) in the dictionary "data".

The dictionary is converted to a dataframe with the Pandas python package and displays the data in tabular format on the screen.

You might be interested in
Which term represents a computational instruction stored in computer memory?
lys-0071 [83]
A computational instruction with operands is command so computational instructionis just a opcode.
B. opcode
4 0
3 years ago
Read 2 more answers
PLEASEE HELPP.... QUESTION... how does coding impact your life​
nataly862011 [7]

Answer: It allows us to do everyday tasks on the internet

Explanation: We wouldn’t be able to email, research, etc without coding!

6 0
3 years ago
Read 2 more answers
Which generation is called the new silent generation? A. Generation X B. the homelander generation C. the millennial generation
____ [38]

Which generation is called the new silent generation?

A. Generation X

<u>B. the homelander generation </u>

C. the millennial generation

D. the boom generation

6 0
3 years ago
I'll mark you the brainlest please help
nikklg [1K]

Hello There!

<u>ANSWER:</u>

<u></u>

C.

Hopefully, this helps you!!

AnimeVines

3 0
3 years ago
Read 2 more answers
If the current through a heater coil is 5 amp and the supply voltage is 120 volts, the coil resistance is
ss7ja [257]
Resistance measured in Ohms = Voltage divided by current.
120/5=24

B) 24 Ohms
7 0
3 years ago
Other questions:
  • Which of the following is the final fate for average sized stars?
    12·1 answer
  • What happens when a user updates a record after a developer creates a Workflow Rule declaratively that updates a field on an obj
    6·1 answer
  • .<br> 1. Press the _______ key to move to the next cell in a row.
    14·2 answers
  • Type the correct answer in the box. Spell all words correctly.
    11·2 answers
  • In C++ please.
    8·1 answer
  • What malware looks like a useful or desired executable program but is, in reality, a program that is supposed to cause harm to y
    11·1 answer
  • Accenture is helping a large retailer transform their online sales and services. The Data Analyst audits the client’s customer j
    12·1 answer
  • Write a program that reads a list of integers, and outputs the two smallest integers in the list, in ascending order. The input
    5·1 answer
  • WHICH PROGRAMMING LANGUAGES ARE THE BEST FOR PROGRAMMING?
    14·1 answer
  • If you walked into a room containing three computers and were told one of them was infected with malware, how would you determin
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!