Let A and B two text files, containing some binary lines between of length 1...N. Where N is the line with the maximum number of characters, 1 the minimum number of characters in each line. Design a Python3 function to compare each line of the files, character by character, and if there is a match of the characters, create a variable representing the similarity between the lines of each file, and return that similarity variable measures the similarity between two files.
Q: 7- There are important differences between values that are printed and output values. Consider the…
A: a. f(1) We are sending 1 as argument to function f and then inside the function we are displaying…
Q: Write a cpp file and Pass two one dimensional array as an arguments to a function and compare the…
A: Code : // C++ program to find given two array// are equal or not#include <bits/stdc++.h>using…
Q: 7- There are important differences between values that are printed and output values. Consider the…
A: Task : In the given question , the code for the three functions is given below. The task is to find…
Q: In c++ creates a function checkWord that: 1) uses an input file stream to read input file (file1)…
A: SUMMARY: - Hence, we get the output.
Q: Write a C++ program to create a new file named "college.txt" to store list of colleges under Punjab…
A: C++ program to create a new file to store the list of colleges under the Punjab University. The name…
Q: Mrite a function that takes two lists of integers x and Y as input, and computes and writes a table…
A: def op2file(X, Y): f = open("C:\\Users\\Dell\\OneDrive\\Desktop\\question2.txt", "w") for i in…
Q: (a) Write a program in C to create a text file named bmi.txt and store the data from the following…
A: Required: create a program to create a text file with the given table. after that create another…
Q: Each line of a hockey file contains a four-digit year, a team name, and a two-digit number of wins.…
A: The text for the code is given below: f = open('hockey.txt')lines = f.readlines()f.close() def…
Q: Given main(), complete the Car class (in files Car.h and Car.cpp) with member functions to set and…
A: Car.h #ifndef CARH#define CARH class Car{private:int modelYear; int purchasePrice;int currentValue;…
Q: Given the 5 records below stored in a file, write a code snippet that will extract two elements…
A: Since no programming language is mentioned the question, I have provided the code in java language…
Q: Write a function file_copy that takes two string parameters (in_file and out_file) and copies the…
A: Python code :: #!usr/bin/env python def file_copy(infile, outfile): in_f = open(infile,'r') #…
Q: Write a C++ program that: • Creates a function checkWord that: a. uses an input file stream to read…
A:
Q: Write a function find_decrypted_words() that takes a file name as parameter, reads that text file…
A: Given:
Q: .Define a function named “read_matrix” that takes filename as a parameter and reads the…
A: Algorithm : read_matrix function Step 1 : open the file in read mode where filename is taken as…
Q: Given a file. In that file data is given in roman numbers form. You have to read that data in roman…
A: Read the data from file and convert the roman number into numeric and print the character at the…
Q: Write a Python function that implements sequential search. The function takes two parameters - a…
A: def linear_Search(file, value): #function takes filename and searching value f = open(file, 'r')…
Q: Python: Character Histogram
A: Summary: In this question, we have been one program and we have to write the code in python. In…
Q: You are given a file consisting of students' names in the following form: lastName , firstName…
A: A C++ program is as follows, File name: “main.cpp” //Header files #include<iostream>…
Q: In Python Define a function writeScores with two parameters. The first should be the name of a file,…
A: Below is the approach and python code:Approach:Define a function “writeScores” having two parameters…
Q: stim Technique University Proffessor is teaching two courses, namely CENG103 and CENG104. For each…
A: //GradeBook.h interface File#include<iostream>using namespace std;class GradeBook{ public:…
Q: 2. Using the algorithm developed above, create a function that determines the status of the first…
A: Create a text file. file.txt contains:
Q: Task: Write a program, using functions only, with the following features. 1. Program reads…
A: Actually, string is a sequence of characters.
Q: Need help in creating a C(NOT C+ OR C#) function that will help split a string present in a Text…
A: #include <stdio.h>#include <string.h> int main(){ char word[30]; FILE *fp;…
Q: Write a Python program that calculates the average 5 quiz scores from a file with student ID and…
A: Note: Both txt files and .py files should be saved in Desktop. i consider only 5 quizes but the…
Q: Consider the binary file named, "Course_Data" whose format is below. Each record represents a course…
A: Course_Data obj; int avg=0; for(int i=1;i<=obj.NOA;i++){ if(obj.LGrade=='A'){ avg+=obj.NGrade; }…
Q: 1. Given two .txt files that have lists of numbers in them, find the numbers that are overlapping…
A: HEre is the approach :- First create function to read the files . open the files using the…
Q: Write a Python program that chooses the best 5 quiz scores from a file with student ID and scores.…
A: In this program we need to first open the file and then extract the student id and list of scores.…
Q: ease Program in python and leave comments to help explain here is the google drive with the…
A: Required: Please Program in python and leave comments to help explain The objective is to create a…
Q: A text file contain birth date of some employees with format dd/mm/yy: 01/06/50 03/06/51 10/02/54…
A: task: Read the file using C and find out how many employees with age: –above 51 –between 44 – 51…
Q: lease Program in python and leave comments to help explain here is the google drive with the…
A: Required: Please Program in python and leave comments to help explain The objective is to create a…
Q: Write a function named framestr that takes as input a string s, and PRINTS on the screen a framed…
A: len(s) find length of string s '-' * n '-' copy it n times if n=5 '-'*n = '-'*5 = '-----'
Q: Write a C(not C++) program that reads the exam data for each student from a file named grades.txt.…
A: Place the adequate header files. Declare necessary variables. Open the grades.txt file in read mode.…
Q: Write a function that reads a single line "question1.txt", and returns the average the file is as…
A: Begin by creating a text file and storing numbers in it. I have named my file question1.txt.…
Q: Please help write the functions (context for the problem in the images): write_X_to_map(filename,…
A: Coded using Python 3.
Q: 2. Using the algorithm developed above, create a function that determines the status of the first…
A: The function status of return type void and four parameters can be defined to find the status of…
Q: A vector is given by X = [-1, 2, -3, 8, 0, - 7, 12, 4, 20, -6, 6, 4, -7, 16]. Write a program as a…
A: Python Program :- X=[-1,2,-3,8,0,-7,12,4,20,-6,6,4,-7,16]X1=[]X2=[] for i in X: if i>=0 and…
Q: C++ program to create a new file named “college.txt” to store list of colleges
A: Program: // C++ Version 14#include<iostream>#include<fstream>using namespace std;//…
Q: You are given a file consisting of students’ names in the following form: lastName, firstName…
A: Note: Programming language is missing in the question. So we will answer this program in C++…
Q: Implement a function wordCount, which reads a text file, and returns the number of words in the…
A: since you haven't mentioned the programming language, we are answering this in c. Program code:…
Q: using CSV write a function that takes a list of strings as inputs, and returns a single string…
A: We will join the passed strings using join() function. Below is the function which will join the…
Q: Need help in creating a C(NOT C+ OR C#) FUNCTION that will help split a string present in a Text…
A: Use of strtok () The strtok() function reads string1 as a series of zero or more tokens,…
Q: C Programming Task Write a programme called pgmReduce which takes 3 arguments: 1. an input file…
A: #include<stdio.h> int main() { #ifndef ONLINE_JUDGE // getting input from input.txt file…
Q: Each line of a hockey file contains a four-digit year, a team name, and a two-digit number of wins.…
A: - We need to code the team problem. - We have to use python here.
Q: Consider a square region in the first quadrant of the Cartesian plane whose bottom left and upper…
A: Here is the program with the function:
Q: Write a program, using functions only, with the following features. 1. Program reads paragraph(s)…
A: #include <iostream>#include <map> // A map will be used to count the words.#include…
Q: n C++, add movies and prices to an existing text file using STL iterators, containers , or…
A: ALGORITHM:- 1. Open the file in the append mode. 2. Take choice from the user for adding the movie…
Q: Write a Python script that extracts and prints a single record from an input file in wrntIrunt uata…
A: infile.readline() read 1 line from the file pointed by infile first_record.split(':')…
Q: Write a function that takes two lists of integers X and Y as input, and computes and writes a table…
A:
Let A and B two text files, containing some binary lines between of length 1...N. Where N is the line with the maximum number of characters, 1 the minimum number of characters in each line.
Design a Python3 function to compare each line of the files, character by character, and if there is a match of the characters, create a variable representing the similarity between the lines of each file, and return that similarity variable measures the similarity between two files.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 2 images
- 1.A text file contain birth date of some employees with format dd/mm/yy: 01/06/50 03/06/51 10/02/54 08/01/48 26/08/51 27/04/54 21/09/51 … and so on Read the file using C and find out how many employees with age: –above 51 –between 44 – 51 –between 36 – 43 –between 28 – 35 –below 28 (note : age = now – birth date) Using C Language, modulo, and file processing, Sir, thx.Each line of a hockey file contains a four-digit year, a team name, and a two-digit number of wins.Here is one such file, hockey.txt:2003maple leafs452020maple leafs351995senators181996maple leafs302000senators482012canadiens48The first line of the file, for example, says that in 2003 (year), the maple leafs (team name) had 45 wins.Write a function that takes an open hockey file and returns a list of tuples,where each tuple refers to a team name and that team's maximum number of wins in any year.Here is a sample call of the function on hockey.txt:>>> teams_and_most_wins(open('hockey.txt'))[('maple leafs', 45), ('senators', 48), ('canadiens', 48)]"""from typing import TextIOdef teams_and_most_wins(f: TextIO) -> list[tuple[str, int]]:'''f is an open hockey file.Each year has 4 digits and each number of wins has 2 digits.Return a list of tuples where each tuple storesa team name and that team's maximum number of wins in any year.Every team should appear in exactly one of the…In Python: Build a function that takes a record from your FASTA file as an argument, and returns a count of each amino acid coded for by the codons of the sequence. Keep in mind that because these records are not necessarily in the proper reading frame, so the user should be prompted to select a reading frame (0, +1, +2). You should put some thought into the presentation of your results by your main function, making sure they are clear and readable. The fasta file contains the below: >MD10G1276500 pacid=40089867 polypeptide=MD10G1276500 locus=MD10G1276500 ID=MD10G1276500.v1.1.491…
- Please I want a python program for this using CSV write a function that takes a list of strings as inputs, and returns a single string created by joining all the input strings together, with a comma separating them. Now write another function that takes a list of lists of strings, applies the operation from question 1 to each list, and writes the result as a row of an output file. The function should return the path to the file where the strings were written. 3. Now, write the reverse of question 2: write a function that takes in a filename (which we will assume is a CSV), and returns a list of lists of strings, where one row in the file corresponds to one list in the output list (and each value between the commas in the file row is one element in the list).C Program Task Write a programme called pgmReduce which takes 3 arguments:1. an input file (either ASCII or binary)2. an integer factor n, and3. an output fileand reduces the input file by that factor in each dimension. For example, if the invocation is:pgmReduce inputFile 5 outputFileand inputFile is a 13x17 image, then outputFile should be a 2x3 image in which only thepixels with row and column of 0 modulo 5 in the inputFile exist.Write a program that computes and prints the average of the numbers in a text file. You should make use of two higher-order functions to simplify the design. Ask the user for the name of the .txt file that contains the list of numbers. Include your code as usual in a .txt AND .py file. Create and use a .txt file to test your code using the numbers 78, 54, 22, 90, 15, 7.
- Write a program, using functions only, with the following features.1. Program reads paragraph(s) from the file and stores in a string.2. Then program counts the occurrence of each word in the paragraph(s) and stores all words with their number of occurrences.3. If that word has appeared more than one time in whole string, it should store the word only once along its total number occurrences.4. The output described in above (int part 3) must be stored in a new file. Sample input:is the is and the is and the and is and only that isSample output:is 5the 3and 4only 1that 1Consider the binary file named, "Course_Data" whose format is below. Each record represents a course with a single letter grade, a numerical grade, and the number of assignments in the course. Write a block of code to read the first 200 records and find and print the average of all courses whose letter grade was an "A". Maximum 20 lines of code for credit. (Assume all libraries are included) File format:{ char LGrade; // Letter Grade: A, B, C, D, F (Single letter) int NGrade; // Number Grade: 0 - 100 int NOA; // Number of assignments: 1 - 20}Write a program, using functions only, with the following features.1. Program reads paragraph(s) from the file and stores in a string.2. Then program counts the occurrence of each word in the paragraph(s) and stores allwords with their number of occurrences.3. If that word has appeared more than one time in whole string, it should store the wordonly once along its total number occurrences.4. The output described in above (int part 3) must be stored in a new file.
- In c++ creates a function checkWord that:1) uses an input file stream to read input file (file1) containing correctwords from the English dictionary into a proper STL container.2) uses an input file stream to read another input file (file2) containinguntrusted English.3) Words that we need to check its correctness against the trusted filefrom the dictionary.4) Prints the incorrect words in file2 after checking it against file1.5) If there are no incorrect words, the function should print “All wordsare correct”.Write a function that takes two lists of integers X and Y as input, and computes and writes a table into a file named "question2.txt" as follows: - On each line the computations for an X,Y pair is given Each such possible pair must exist in the file in the same order of values in X and Y Next on each line, you provide X+Y, X*Y and X^2 + Y^2, all separated by a comma (and no spaces or other characters must exist). Note that X^2 represents "square of X". For example, given X = [1,3] and Y=[-1,1,0], "question2.txt" should contain the following table: question2.txt 1,-1,0,-1,2 1,1,2,1,2 1,0,1,0,1 3,-1,2,-3,10 3,1,4,3,10 3,0,3,0,9 As you can see, the first line is computed for X=1, Y=-1. The second line is built for X=1, Y=1; and the third line is for X=1, Y=0. It goes on like this, until X=3, Y=0. def op2file(X, Y): in pythonWrite a function count_character(filename, character) that takes in a filename and a character, both as strings, and returns the total number of times the given character occurs in the file. Examples: Contents of hello.txt:HelloHELLOHelloHELLO count_character('hello.txt', 'L') returns 4count_character('hello.txt', 'H') returns 4count_character('hello.txt', 'e') returns 2 Requirements: Please use Python Programming only Show screenshot of your work.