In a text file, I have two numbers each line. The numbers are the employee ID and the number of hours the employee work. My goal of this
For example
File.txt
EmployeeID Number of Hours Work
3 12
2 20
1 40
5 20
7 9
In the main program print:
EmployeeID Number of Hours Work
1 40
2 20
3 12
5 20
7 9
Step by stepSolved in 3 steps with 2 images
- this code should be in python: The person running the file will be asked to choose one of these games but for each game it has its own main like (main1, main2, etc.). These functions are called when the user selects a game from 1 to 5 (If the user selects game 1, main1 will be executed). This should be in one python file. my code for each game: #game 1 you're supposed to input a sequence and the values are supposed to be shown how many times they are shown:input = input("Please enter your sequence:")print("In the sequence we saw:")for i in range(10):k = 0k = sum(int(c) == i for c in input)if k > 0:print("{}: {} time(s)".format(i, k))#game 2 is to supposed to enter 2 values as a range and it shows the 3 multipication in that range:num1 = int(input("Enter Number 1:"))num2 = int(input("Enter Number 2:"))if(num1>num2):for i in range(num2+1,num1):if(i%3 == 0):print(i)if(num1<num2):for i in range(num1+1,num2):if(i%3 == 0):print(i)#game 3 is a program that receives a string from the…arrow_forwardWhen analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This adjustment can be done by normalizing to values between 0 and 1, or throwing away outliers. For this program, adjust the values by dividing all values by the largest value. The input begins with an integer indicating the number of floating-point values that follow. Assume that the list will always contain fewer than 20 floating-point values. Output each floating-point value with two digits after the decimal point, which can be achieved as follows:System.out.printf("%.2f", yourValue); Ex: If the input is: 5 30.0 50.0 10.0 100.0 65.0 the output is: 0.30 0.50 0.10 1.00 0.65 The 5 indicates that there are five floating-point values in the list, namely 30.0, 50.0, 10.0, 100.0, and 65.0. 100.0 is the largest value in the list, so each value is divided by 100.0. For coding simplicity, follow every output value by a space, including the last one.arrow_forwardIn C++ (don't copy paste the same answer that is already on this site, post unique code) Structures A menu-driven program gives the user the option to find statistics about different baseball players. The program reads from a file and stores the data for ten baseball players, including player’s team, name of player, number of homeruns, batting average, and runs batted in. (You can make up your data, or get it online ) Write a program that declares a struct to store the data for a player. Declare an array of 10 components to store the data for 10 baseball players. The program prints out a menu (in a loop, so this can be done again and again) giving the user a choice to: print out all users and statistics print out the statistics for a specific player print out all data for a specific team update the data for a particular player (change one of the statistics) DO ALL WORK IN FUNCTIONS. USE A FUNCTION TO READ THE DATA, A FUNCTION TO PRINT THE MENU, and FUNCTIONS FOR EACH OF THE MENU…arrow_forward
- In this project, you will develop algorithms that find road routes through the bridges to travel between islands. The input is a text file containing data about the given map. Each file begins with the number of rows and columns in the map considered as maximum latitudes and maximum longitudes respectively on the map. The character "X" in the file represents the water that means if a cell contains "X" then the traveler is not allowed to occupy that cell as this car is not drivable on water. The character "0" in the file represents the road connected island. That means if a cell contains "0" then the traveler is allowed to occupy that cell as this car can drive on roads. The traveler starts at the island located at latitude = 0 and longitude = 0 (i.e., (0,0)) in the upper left corner, and the goal is to drive to the island located at (MaxLattitude-1, MaxLongitudes-1) in the lower right corner. A legal move from an island is to move left, right, up, or down to an immediately adjacent…arrow_forwardPROBLEM 1: Have you ever wondered how websites validate your credit card number when you shop online? They do not check a large database of numbers. Most credit providers rely on a checksum formula for distinguishing valid numbers from random collections of digits (or typing mistakes). The objective of this lab you will implement a program that read a file that contains a table with two columns: A column of customer names and a column of credit card numbers. For each customer, print the validity of the credit card number and name of the corresponding credit card company (if the number is valid), For our purpose, the algorithm that valid credit cards is the following: Double the value of every second digit beginning from the right. That is, the last digit is unchanged; the second-to-last digit is doubled; the third-to-last digit is unchanged; and so on. For example, [1,3,8,6] becomes [2,3,16,6] Add the digits of the doubled values and the undoubled digits from the original number. For…arrow_forwardI am confused on how to go about writing this python program.arrow_forward
- The function print_last_line in python takes one parameter, fname, the name of a text file. The function should open the file for reading, read the lines of the file until it reaches the end, print out the last line in the file, report the number of lines contained in the file, and close the file. Hint: Use a for loop to iterate over the lines and accumulate the count. For example: Test Result print_last_line("wordlist1.txt") maudlin The file has 5 lines.arrow_forwardPlease do fastarrow_forwardIN PYTHON: Using a function, create a list of 20 numbers randomly between 1-99. With recursive function, you are going to take the numbers from the list, one at a time starting at position 0 and add them together. If the numbers added together equals a user specified sum, stop the program and show the two digits that sum together. If not, remove the first number from the list and add the next two. Continue running the program until you have reached the end of the list. sample output: randomly selected numbers: [61, 6, 78, 3, 64, 22, 11, 9, 34, 99, 31, 56, 43, 8, 77, 27, 93, 47, 58, 20] User input : 86 61 + 6 = 67 FALSE [6, 78, 3, 64, 22, 11, 9, 34, 99, 31, 56, 43, 8, 77, 27, 93, 47, 58, 20] 6 + 78 = 84 FALSE [78, 3, 64, 22, 11, 9, 34, 99, 31, 56, 43, 8, 77, 27, 93, 47, 58, 20] 78 + 3 = 81 FALSE [3, 64, 22, 11, 9, 34, 99, 31, 56, 43, 8, 77, 27, 93, 47, 58, 20] 3 + 64 = 67 FALSE [64, 22, 11, 9, 34, 99, 31, 56, 43, 8, 77, 27, 93, 47, 58, 20] 64 + 22 = 86 TRUE!arrow_forward
- This question is Chapter 9 programming exercise question 3.arrow_forwardIn this lab, we will practice the use of arrays. We will write a program that follows the steps below: Input 6 numbers from the user user inputs numbers one at a time Loop continuously until the exit condition below: ask the user to search for a query number if the query number is in the list: reports the first location of the query number in the list, change the number in that position to 0, show the updated list if the query number is not in the list: exit the loop You must write at least one new function: findAndReplace(array1,...,query) – take in an array and query number as input (in addition to any other needed inputs); it will return the first location of the query number in the list (or -1 if it is not in the list) and will change the number at that location to 0. You may receive the number inputs and print all outputs in int main if you wish. You may report location based on 0-indexing or 1-indexing (but you need 0-indexing to access the array elements!).arrow_forwardThe GTUC Company wants to produce a product orders report from its product orders file. Each record on the file contains the product number of the item ordered, the product description, the number of units ordered, the retail price per unit, the freight charges per unit, and the packaging costs per unit. Your algorithm is to read the product orders file, calculate the total amount due for each product ordered and print these details on the product orders report.The amount due for each product is calculated as the product of the number of units ordered and the retail price of the unit. A discount of 10% is allowed on the amount due for all orders over 100.00. The freight charges and packaging costs per unit must be added to this resulting value to determine the total amount due.arrow_forward
- Computer Networking: A Top-Down Approach (7th Edi...Computer EngineeringISBN:9780133594140Author:James Kurose, Keith RossPublisher:PEARSONComputer Organization and Design MIPS Edition, Fi...Computer EngineeringISBN:9780124077263Author:David A. Patterson, John L. HennessyPublisher:Elsevier ScienceNetwork+ Guide to Networks (MindTap Course List)Computer EngineeringISBN:9781337569330Author:Jill West, Tamara Dean, Jean AndrewsPublisher:Cengage Learning
- Concepts of Database ManagementComputer EngineeringISBN:9781337093422Author:Joy L. Starks, Philip J. Pratt, Mary Z. LastPublisher:Cengage LearningPrelude to ProgrammingComputer EngineeringISBN:9780133750423Author:VENIT, StewartPublisher:Pearson EducationSc Business Data Communications and Networking, T...Computer EngineeringISBN:9781119368830Author:FITZGERALDPublisher:WILEY