Assume that a file containing a series of integers is named numbers.txt. Write a program that calculates the average of all the numbers stored in the file.
Q: ’POLISH’ PEASANT MULTIPLICATION Write a program using a language of your choice, that multiply two…
A: We have to create a program in Python that implements the "Polish Peasant Multiplication" method. To…
Q: Write the code in python Create an application that can create, display, search and maintain the…
A: def CreateBook(): book = open("book.txt", "w") while True: bookName = input("Enter your…
Q: please code in python count_word: This function takes a filename and a keyword. Return the number…
A: Python is a high-level, general-purpose programming language that was created in the early 1990s by…
Q: wordCount.py: Write a program that reads words from a file (filename given as a command-line…
A: Introduction Command line arguement: Command-line arguments are values passed to a program or script…
Q: Average Number of Words If you have downloaded the source code from the Computer Science Portal you…
A: The answer is..
Q: The function file_first_chars in python takes one parameter, fname, the name of a text file, and…
A: Introduction: Programming involves dealing with files on a regular basis. Python has built-in…
Q: A file concordance tracks the unique words in a file and their frequencies. Write a program that…
A: filename = input('Enter the input file name: ') d = {} with open(filename, 'r') as f: for line…
Q: Write code that does the following: opens a file named MyName.txt, reads the first linefrom the file…
A: Write code that does the following: opens a file named MyName.txt, reads the first linefrom the file…
Q: The "gets" function will read a whole line of text from file into a char[] so long as the line of…
A: The question asks if the "gets" function reads the entire line of text in the file into char[] as…
Q: Time remaining: 01:47:21 Computer Science The file numbers.txt contains integer numbers, one number…
A: NOTE - I have used python programing language. I have opened the file and stored the object into a…
Q: USING PYTHON Exercise 1 Create a text file called pi_digits.txt as shown below . 1. Read the…
A: 1. Create a text file called pi_digits.txt with initial content:Open the file in write mode…
Q: ask: Loading data from files This exercise will require you to load some information from files and…
A: Java code is implemented below
Q: Write a program that writes a series of randor numbers to a file. Each random number should be in…
A: 1) Since you have not specified programming language, I have written program in python 2) Above is a…
Q: File Operations:Write a complete program that reads integers from a file called numbers.txt, and…
A: - We need to have a computer program that adds the values in a text file and displays it in the…
Q: B. Write the C++ statements that will open the input file f1owers.dat for reading. Write a while…
A: #include <fstream>#include <iostream>#include <string>using namespace std;int…
Q: COMPUTER SCIENCE 130 JAVA PROGRAM Chapter 4. Homework Assignment (read instructions carefully)…
A: 1. Initialize a Scanner for user input and a String variable 'fileName' to store the input file…
Q: num.txt is a file that contains a list of scores. num.txt 10 25 36 45 89…
A: As nothing mentioned in the question I am using c++ to code the program.
Q: Write code that does the following: opens an output file with the filename number_list.txt, uses a…
A: Algorithm: 1. Start 2. Create a file called "number_list.txt". 3. Initialize a loop from 1 to 100.…
Q: Using C++ Language Create a file named data.dat and enter the following numeric data: 10 15 11 12…
A: Here I written C++ code as per your problem. I hope you like it.
Q: JAVA Requirements This program will take Names and Grades from a .txt file as input. We will then…
A: Actually, the given information is; The program must use a switch argument.• The program must Read…
Q: ng Files - Student Line Up ify the Student Line Up program described in Programming Challenge 1 es:…
A: Complete C++ code with explanation: #include <iostream> #include <fstream> #include…
Q: C PROGRAMMING MOST IMPORTANT THING THE PASSWORD HAS TO BE READ FROM A TEXT FILE!!! I have a…
A: Given: C Program to validate password from a given file "passcode.acc".
Q: The problem statement is: Problem Statement: You will write a program to analyze employee…
A: # extract numbers from the file and returns a listdef readFile(filename): # to store numbers…
Q: 5. Sum of Numbers Assume a file containing a series of integers is named numbers.txt and exists on…
A: I give the code in Python along with output and code screenshot
Q: Using Python A file named data.txt contains an unknown number of lines, each consisting of a single…
A: The answer is as follows
Q: e takes one parameter, fname, the name of a text file. The function should open the file for…
A: We need to define the function called get_second_line that accepts the file name as input, opens the…
Q: containing a list of photo file names. The program then reads the photo file names from the text…
A: Code: file = open("ParkPhotos.txt") for i in file: temp = i.strip().replace(…
Q: VB Small Project 18 – Numbers to a File Write a Visual Basic program that asks the user for a…
A: In this question we have to write a VB program that ask user for input and we have to insert data to…
Q: C++ Create a program that reads a file containing a list of songs and prints the songs to the screen…
A: Program approach: Starting of a program. Including the header files. <fstream>: To open a…
Q: Write a program that asks the user for the name of a file. The program should display only the first…
A: Python version : 2.7 Python program that asks the user for the name of the file and displays only…
Q: The Clay Hill Golf Club has a tournament every weekend. the club president ask you to write two…
A: In this question we have to write a program for the code to store player name and golf scores in a…
Q: JAVA PROGRAM Chapter 4. Homework Assignment (read instructions carefully) Write a program that…
A: Algorithm: FileTotalAndAverage1. Import required libraries: - java.io.BufferedReader -…
Q: Attached Files: sample.txt (11.069 KB) You will only get one submission. I need a python…
A: Three counters are used to keep track of the running count of the words being read from the supplied…
Q: Count characters, words, and lines in a file Write a program that will count the number of…
A: Writing this code on Python Language version 3.9 CODE:- filename = input("Enter file name: "); #…
Q: Make the following modifications for the solution above: name the output/input file…
A: Some important terms used in the solution above. with open(...) as f:: This is a Python construct…
Q: Python programming language Write a program that asks the user for a number. Write the number…
A: Given: Python programming language Write a program that asks the user for a number. Write the…
Q: JAVA PROGRAM Chapter 4. Homework Assignment (read instructions carefully) Write a program that…
A: It seems that the program you provided has some issues when running on Hypergrade due to formatting…
Q: esign a program that reads a file called sales.txt containing the following data: ane, 215.5,…
A: Since no programming language is mentioned, I am using python. Algorithm: Start Read file data line…
Q: JAVA PROGRAM Chapter 4. Homework Assignment (read instructions carefully) Write a program that…
A: In the realm of software development, especially when dealing with file operations, ensuring that…
Q: Create a pyton file which will compute the mean upon opening a certain txt file named numbers.txt…
A: l=list(map(int,input().split()))su=0for i in l: su+=i;print(su/len(l))
Q: C++ Add a search command that asks the user for a string and finds the first line that contains…
A: All the code are shown below.
Q: Write a program that reads words from a file (filename given as a command-line argument) and prints…
A: create a input file : input.txt If there's a problem yo I'll solve itCheck out the hook while…
Assume that a file containing a series of integers is named numbers.txt. Write
a program that calculates the average of all the numbers stored in the file.
Trending now
This is a popular solution!
Step by step
Solved in 3 steps with 3 images
- GirlNames.txt This file contains a list of the 200 most popular names given to girls born in the United States from the year 2000 through 2009. BoyNames.txt This file contains a list of the 200 most popular names given to boys born in the United States from the year 2000 through 2009. Write a program that reads the contents of the two files into two separate lists. The user should be able to enter a boy’s name, a girl’s name, or both, and the application will display messages indicating whether the names were among the most popular. **programming language is python** ** must use a def main(): function** *please include some comments* i aslo have the .txt files but no wya to upload themChapter 4. PC #14. Line Numbers (page 265) Write a java program that asks the user for the name of a file. The program should display the contents of the file with each line preceded with a line number followed by a colon. The line numbering should start at 1. I should be easily type input1.txt and easily print out the output in Eclipse. Please enter the file name or type QUIT to exit:\nquitENTER Test Case 2 Please enter the file name or type QUIT to exit:\nbadfilename.txtENTERFile: badfilename.txt does not exist.\nPlease enter the file name again or type QUIT to exit:\nquitENTER Test Case 3 Please enter the file name or type QUIT to exit:\ninput1.txtENTER1: a\n2: b\n3: c\n4: d\n2. Message Decoder Create a MessageDecoder program that reads from a file (one character at a time), and writes all non-numeric characters to a file called DecodedMessage.txt, displaying a secret (and motivational) message. ***Hint: .read() will return an int, but this can be type cast as a char. int and char are interchangeable (via type-caşting). You could run a loop on a condition like charInFile != (char) -1 Don't forget that -1 is a special character that denotes the end of a file!
- JAVA PROGRAM Chapter 4. Homework Assignment (read instructions carefully) Write a program that asks the user for the name of a file. The program should read all the numbers from the given file and display the total and average of all numbers in the following format (three decimal digits): Total: nnnnn.nnn Average: nnnnn.nnn Class name: FileTotalAndAverage PLEASE FIX AND MODIFY THIS JAVA SO WHEN I UPLOAD IT TO HYPERGRADE IT PASSES ALL TEST CASSES PLEASES. RIGHT NOW IT SAYS 0 OUT 3 PASSED. THE PICTURES THAT I PROVIDED PROOF THAT WHEN I UPLOAD IT TO HYPERGRADES IT FAILS TEST CASSES. THANK YOU. import java.io.*;import java.util.Scanner;public class FileTotalAndAverage { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); System.out.println("Please enter the file name: "); while (true) { String fileName = scanner.nextLine(); File file = new File(fileName); if (file.exists() &&…A program stores the prime numbersin a file named PrimeNumbers.dat. Write a program that finds the numberof prime numbers that are less than or equal to 12, 120, 1,200, 12,000,100,000, 1,200,000, 12,000,000, 120,000,000, 1,200,000,000, and12,000,000,000. Your program should read the data from PrimeNumbers.dat.In Python, Create a program that will write 100 integers created randomly in a file. The integers will be separated by a space in the file. Read the data back from the file, and display the sorted data. The program should prompt the user to enter a file name. Utilize the following function headers for this problem: Main() WriteNumbers(filename) ReadNumbers(filename) The main function will first prompt the user to enter the filename. Then the main function calls WriteNumbers-then ReadNumbers. The WriteNumbers function opens an output file and writes 100 random numbers as long a large string text. Do not use lists for this problem- please just write a random number followed by a space 100 times. The ReadNumbers function will then read the text file and display the numbers sorted. In order to sort the numbers, read the big string and then split it into a list. Now convert them into integers by using list comprehension and then sort the list. Loop through the list and print each…
- 1. Create a file that contains 20 integers or download the attached file twenty-integers.txttwenty-integers.txt reads:12 20 13 45 67 90 100 34 56 89 33 44 66 77 88 99 20 69 45 20 Create a program that: 2. Declares a c-style string array that will store a filename. 3. Prompts the user to enter a filename. Store the file name declared in the c-string. 4. Opens the file. Write code to check the file state. If the file fails to open, display a message and exit the program. 5. Declare an array that holds 20 integers. Read the 20 integers from the file into the array. 6. Write a function that accepts the filled array as a parameter and determines the MAXIMUM value in the array. Return the maximum value from the function (the function will be of type int). 7. Print ALL the array values AND print the maximum value in the array using a range-based for loop. Use informational messages. Ensure the output is readable.Create a program that asks the user for the name of a file and then rearranges the contents of the file so that its lines are in alphabetical order. The program should modify the file, not just print its contents to the screen. Use the STL algorithm sort. C++PYTHON PROGRAMMING ONLY PLEASE (PLEASE INCLUDE INPUT VALIDATIONS IF NECESSARY) Write a program that writes a series of random numbers to a file. Each random numbershould be in the range of 1 through 500. The application should let the user specify howmany random numbers the file will hold
- A file named data.txt contains an unknown number of lines, each consisting of a single integer. Write a program that creates the following three files: dataplus.txt dataminus.txt zeros.txt The program should read each line of the data.txt file and perform the following: If the line contains a positive number, that number should be written to the dataplus.txt file. If the line contains a negative number, that number should be written to the dataminus.txt file. If the line contains the value 0, do not write the value to a file. Instead, keep a count of the number of times 0 is read from the data.txt file. After all the lines have been read from the data.txt file, the program should write the count of zeros to the zeros.txt file.In Python Write a program that consists of (at least) two function: A function that creates and saves data in a file. The saved data represents exam grades. In the function, you will create n random numbers in the range [0,100], where n is the number of students. The function can be called as follows: createFile(filename, n) Main function, in which the user inputs the file name and the number of students, then the main calls function createFile. The main should perform validation for n (should be > 0), and the filename (should end with .txt). I will explain how to validate strings in the coming lecture. Hint: a good developer will write four functions to solve the problem.JAVA PROGRAM Chapter 4. Homework Assignment (read instructions carefully) Write a program that asks the user for the name of a file. The program should read all the numbers from the given file and display the total and average of all numbers in the following format (three decimal digits): Total: nnnnn.nnn Average: nnnnn.nnn Class name: FileTotalAndAverage PLEASE FIX, CHANGE AND MODIFY THIS JAVA PROGRAM SO WHEN I UPLOAD IT TO HYPERGRADE IT PASSES ALL TEST CASSES PLEASES. RIGHT NOW IT SAYS 0 OUT 3 PASSED. THE PICTURES THAT I PROVIDED PROOF THAT WHEN I UPLOAD IT TO HYPERGRADES IT FAILS TEST CASSES. THANK YOU. import java.io.BufferedReader;import java.io.FileReader;import java.io.IOException;import java.util.InputMismatchException;import java.util.Locale;import java.util.Scanner;public class FileTotalAndAverage { public static void main(String[] args) { Scanner scanner = new Scanner(System.in); String fileName; do {…