1. Write a function in python to count the number of lines from a text file "story.txt" which is not starting with an alphabet "T". Example: If the file "story.txt" contains the following lines: A boy is playing there. There is a playground. An aeroplane is in the sky. The sky is pink. Alphabets and numbers are allowed in the password. The function should display the output as 3
Q: LAB Q - Write a program in c to read names from the file "name.txt", which include (10) names ,then…
A: to use string function string.h header file is include strlen() is use to calculate length of…
Q: Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: Required:
Q: Write a function called printRange () that accepts two integers as arguments and prints the sequence…
A: THe c++ code is given below:-
Q: Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: Algorithm : main function Step 1 : declaring required variables and array. Step 2 : using a for loop…
Q: P1. Write a Python function called reduceWhitespace that is given a line read from a text file and…
A: the- program code in python is given below:
Q: Write a C++ program that reads data from an input file, takes the data and computes student grades…
A: A required C++ program is as follows, #include <iostream> #include <fstream> #include…
Q: Write a function that accepts a person's full name (consisting of exactly two words separated by…
A: I have provided C CODE along with CODE SCREENSHOT and 2 OUTPUT…
Q: 2. Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: The method of designing and developing a computer program that is executable to achieve a particular…
Q: 3. Write a function in Python to read lines from a text file "notes.txt". Your function should find…
A: #method takes word s, and file name#finds and prints occurences of word s in textfile import redef…
Q: Write a function get_january_data that takes a stock symbol and a year as arguments. The function…
A: since you have not mentioned the programming language, I am attempting this in python. if you need…
Q: Exercise 1: Write a python program that reads from a text file whose name is provided by the user…
A: The complete code is given below with the output.
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: Write a program that creates a function to read multiple DNA sequences from the user and writes them…
A: Code: # Python program to convert# altered DNA to protein inputfile ="DNA_sequence_original.txt" f…
Q: Write a C++ program that computes student grades for an assignment as a percentage given each…
A: the program ia an given below :
Q: 2. Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: The code is given below
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: Exercise 5: Write a python program that reads from a text file whose name is provided by the user…
A: Required: Write a python program that reads from a text file whose name is provided by the user…
Q: Write a program to calculate the net pay of an employee, Input the basic pay, pass basic pay to user…
A: Objective: A program is built to insert the information about employees and calculate the net pay by…
Q: You are given a file consisting of students’ names in the following form: lastName, firstName…
A: stud.cpp #include<iostream>#include<fstream>#include<string>using namespace std;…
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: Write a function find_lowers() that takes a file name as a parameter, reads that text file, and…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Read file name…
Q: how to write a function in python 3 that reads a txt file which includes three number (each line has…
A: AlgorithimStartOpen a file in read modeRead a line from file and store the number in variable aRead…
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: Please answer it in Python Below are the first 4 lines of such a file whose number of lines is not…
A: Hey there, I am writing the required solution of the above stated question.Please do find the…
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: 2. Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: Given: Write a c program to store the values of 5 courses into file and read the values from file…
Q: Write a c++ function that reads from a file the name and the weight of each person in pounds and…
A: Function poundtokg() For convert pound to kilogram. The values read from file. step1: Open the file…
Q: a) Write a python program that reads the data file class-a.csv into a data frame and displays 3 rows…
A: Part A: import pandas as pd data = pd.read_csv("class-a.csv") data.head(3)# first 3 student detail
Q: Exercise 1: Write a python program that reads from a text file whose name is provided by the user…
A: from os import pathfile_name=input("enter file name: ")if(path.exists(file_name)): #checking if file…
Q: The file text.txt contains a sentence text written in all small letters and does not have any…
A: import java.io.*; import java.util.*; // We have a class named Main public class Main { // We…
Q: Write a function getQuestions that accepts a single parameter: filename, which is the name of a txt…
A: Note : As you have not mentioned any language for programming but the description clearly shows that…
Q: python Write a function that reads in a text file, and counts the number of times each word occursin…
A: The program first creates a file sample.txt and stores a string in it. Then it reads the created…
Q: Write a Python script that extracts and prints a single record from an input file in which the data…
A: Note: This code should be rewritten instead of copying to the compiler otherwise it will throw a…
Q: 9. Write a Python function called remove_word that accepts two file names and a string as arguments.…
A:
Q: Write a Python program that calculates the average 5 quiz scores fr Your program must have 2…
A: Note: Both txt files and .py files should be saved in Desktop. i consider only 5 quizes but the…
Q: Write a program that creates a function to read multiple DNA sequences from the user and writes them…
A: Python: def convertFileToSequence(filename): clean = -1 # used for determining output # read in file…
Q: 2. Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: Answer:- Source code #include<stdio.h>char computeGrade(double);int main(){ //create a…
Q: Suppose you wanted to read a very large file of text. Which of the following functions would you…
A: Given functions are void readFile1(int f){ char c; while (read(f, &c, 1)==1){…
Q: Exercise 1: Write a python program that reads from a text file whose name is provided by the user…
A: Given:
Q: Write a program to sort a list of numbers of unknown length. Your program must • read in a list (of…
A: The complete code is given below.
Q: Write a function named frameStr that takes as input a string s, and PRINTS on the screen a framed…
A: PROGRAM EXPLANATION: Define a function framestr(str). This function will take a string as an input…
Q: Write a function (in a file called convert_knots.cpp) that converts knots into miles per minute. The…
A: The program is written in C++. Check the program screenshot for the correct indentation. Please…
Q: Write a program in C Write two functions product1()andproduct2( )that can multiply two integers and…
A: EXPLANATION: - The header file stdlib needs to be included to work with files. The product1…
Q: Your function must find the oldest pet of a given breed (3rd input parameter) from the inFile and…
A: 1. function max age : parameter infile outfile breed a. open both file in try block b.…
Q: 2. Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: Create a function for calculating marks. Using if-else-if to determine the grade as per the marks.…
Q: Write a complete C program that inputs marks of a student in 5 courses using any loop and writes…
A: A file is used to store data permanently in a storage device. The file handling feature of C…
Q: You are given a file consisting of students’ names in the following form: lastName, firstName,…
A: Programming language is missing in the question. So we will answer this program in C++ language. If…
Q: Write a function charHistogram(filename: str) -> None that takes the file name of a text file and…
A: It is defined as a frequency distribution shows how often each different value in a set of data…
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
- (5) Write a function called copy_even_lines() that takes two strings (filenames) as input parameters and copies every other line from the first file into the second. That is, counting from 0, it copies the 0th line, the 2nd line, the 4th line, etc. from the first file to the second file. You may assume that both files exist. (6) Write a python program that asks the user for two filenames and calls your function copy_even_lines() from (5) using those two filenames. If one or more files do not exist, your program must handle the exception by repeating the prompts until valid filenames are entered.a) Write a python program that reads the data file class-a.csv into a data frame and displays 3 rows of those data. Please import the suitable library.b) Write a function which receives the data frame from (a) to calculate the BMI and return the BMI data. Include the function call. Height data is in meter and Weight data is in kg. The formula for BMI as follows:BMI = weight / height2c) Display the BMI data in sequence and calculate the mean of BMI. If the mean of BMI is exceeded 25 then display “Students are overweight”.d) Plot the pie chart for BMI distribution with student’s name as a label. Please import the suitable library.Write a program vote.cc that allows to read from a file vote.in thelast names of the candidates in an election and the number of votes received by eachcandidate. The program should then output each candidate’s name, the number of votesreceived, and the percentage of the total votes received by the candidate. Your programshould also output the winner of the election. Your program should have at least the following functions:(a) Write a function openFile that prompts a user to enter a file name and opens it.(b) Write a function closeFile that closes an open file.(c) Write a function getData that reads from the file the candidate names and theirnumber of votes received and returns them in 2 separate arrays.(d) Write a function sumVote that takes as its parameter an array of number of votesand returns the total number of votes.(e) Write a function computePercentages that takes as its parameters an array ofnumber of votes and returns an array of percentages of votes. Your function shoulduse…
- Write a complete C program that inputs marks of a student in 5 courses using any loop and writes these marks into an output file named txt. After that, it reads scores from myElements.txt and computes the grades based on the table below using a programmer-defined function char computeGrade(double score), and displays the grades on screen. Score Grade >= 90 A 80-89 B 70-79 C 60-69 D <= 59 F ----- please, write 1. the c program code 2. include comments on your code 3. contents of the file myElements.txt 4. sample output Thank you so muchpython Write a function that reads in a text file, and counts the number of times each word occursin the file. Then print the words alphabetically with its corresponding count. Each word willbe separated by a space or newline, but there is no guarantee that each word will be on aseparate line.Write a Python program that reads from a file, scores.txt, a list of test scores. Each line in the file contains one score. The program should calculate the average of all the scores, print to screen. The program should also have a function, num_passing, that takes as a parameter the list of grades and returns the number of scores that are above 64For example if scores.txt contained the following: 72 80 98 76 64 34 90 85 55 printed to screen should be: the average is 72 6 scores above 64
- Please use python not java or C++ A straight line can be defined by a pair of points p1(x1, y1) and p2(x2, y2). The slope m of a line is defined as follow: ? = ?% − ?' ?% − ?' Your program reads the points from a text file called ‘points.txt’ which contains the coordinates of unknown number of pairs of points as shown in Figure 1. Each line contains four values x1, y1, x2, y2, where x1, y1 are the coordinates of the first point and x2, y2 are the coordinates of the second point. Figure 1. Input file contains unknown number of point pairs Use Spider, to create the following files: (i) The input file ‘points.txt’ shown in Figure 1. (ii) Your Python program that reads from the input file ‘points.txt’, the coordinates of unknown number of pairs of points, computes the corresponding slopes then prints the results on the screen as shown in Figure 2. Figure 2. The output on screen Your program must define and use the following functions: 1. printHeader(...): prints on screen the three lines…Write a function in python that takes an acrostic as the input and will return the secret message to the user. Include optional arguments to state what makes the first line, as well as what position should be used.a) SATOR\nAREPO\nTENET\nOPERA\nROTAS\n1. Use each index position 0 through 4 b)Elizabeth it is in vain you say\t“Love not” – thou sayest it in so sweet a way:\tIn vain those words from thee or L.E.L.\tZantippe’s talents had enforced so well:Ah! If that language from thy heart arise,\tEndymion, recollect, when Luna tried\tTo cure his love – was cured of all beside\tHis folly – pride – and passion – for he died.“An Acrostic” by Edgar Allen Poehow to write a function in python 3 that reads a txt file which includes three number (each line has one number) assuming these numbers are the side lengths of a triangle. The function checks the validity of the triangle and prints whether the triangle is valid or not. If is is valid, the result should also indicate the type of triangle.
- Please answer it in Python Below are the first 4 lines of such a file whose number of lines is not known a priori: Bella 91.0 18.5 19.5 19.5 19.0 19.5 (91 is a dist note) Azhar 83.0 19.0 18.5 18.5 18.5 19.0 Clara 91.0 17.5 17.5 17.5 18.5 19.0 Dalton 92.5 17.0 18.5 18.5 17.5 18.0 Write a function import_result that takes as an argument the name of the file that contains the results file_name and reads it to make the list of results. Each item in this result list is a dictionary corresponding to a competitor. The keys to this dictionary are: • 'name' with the competitor's name associated • 'note_dist' with which is associated the score obtained by the competitor for the length of his jump. It is known from the question. • 'notes_style' to which is associated the list of 5 marks obtained by the competitor for the style of his jump. Thus, if the file passed as an argument consists only of the 4 lines given as an example previously, the function will return: [{'name': 'Bella',…Create a python code i. Add a function named readfile() to your program that takes a string (filename) as the parameter. You can assume that this file contains a single string. Your function must read the file and return this string. ii. Add a function named scramble() that takes a string parameter (e.g., x). You can assume that x has even length. This function must create two strings such that the first string (e.g., y) is composed of all even numbered characters in x and the second string (e.g., z) is composed of all odd numbered characters in x. For example, if x = "abcdefgh" then y is "aceg" and z is "bdfh". Your function must return these strings (e.g., y and z). iii. Add a function named writefile() to your program that takes three strings as parameter, a filename and two scrambled strings (e.g., y and z), in this order. You function must write these strings y and z on separate lines in the file. This function does not return anything. Docstrings and comments are not necessary.2. Write a complete C program that inputs marks of a student in 5 courses using any loop and writes these marks into an output file named myElements.txt. After that, it reads scores from myElements.txt and computes the grades based on the table below using a programmer-defined function char computeGrade(double score), and displays the grades on screen. - please, write the c program code and include comments on your code, contents of the file myElements.txt , and sample output. Thank you so much.