a. Provide me with your code file, output file and the text file.
1. Create a file with a series of integers. Save it as numbers. txt. Write a program that reads all the numbers and calculates their sum .
2. Create a file having different integers than the first one. Save it as numbers1. txt . Write a program that reads all the number and calculates their average.
Important: The two files that you are creating will contain different numbers.
IN PYTHON PLEASE
program 1:
======================================
with open("numbers.txt") as file1:
lst = file1.readlines()
newList=[]
for i in lst:
newList.append(int(i.strip()))
sum=0
for i in newList:
sum += i
print("Total: ",sum)
===================================
file1 numbers.txt
55
5
87
95
5
62
89
32
48
866
9965
78
963
7824
87
=======================================
//output
====================================
program2
with open("numbers1.txt") as file1:
lst = file1.readlines()
newList=[]
for i in lst:
newList.append(int(i.strip()))
sum=0
for i in newList:
sum += i
avg = sum/len(newList)
print("Average :",round(avg,2))
==============================================
file2 numbers1.txt
12
34
56
78
4
46
34
23
45
23
4
111324
34
46
23
35
4
===========================================
//output2
========================================================
This is the problem as per your requirement
please appreciate my effort by hit like button
and comment below in case having any doubt
a. Provide me with your code file, output file and the text file. 1. Create a...
In Python Provide me with your code file, output file and the text file Create a file having different integers than the first one. Save it as numbers1. txt . Write a program that reads all the number and calculates their average. Important: The two files that you are creating will contain different numbers.
Question 2: Assume that a text file containing a series of integers is named numbers.txt and exists on the c:Temp. Write a program that reads all of the numbers stored in the file and calculates their total. In order to test this program, you may create a text file using notepad. No GUI is necessary. Name the program number.py
Please write this in C. Write this code in Visual Studio and upload your Source.cpp file for checking (1) Write a program to prompt the user for an output file name and 2 input file names. The program should check for errors in opening the files, and print the name of any file which has an error, and exit if an error occurs opening any of the 3 For example, (user input shown in caps in first line) Enter first...
C++ 3. Write a program that reads integers from a file, sums the values and calculates the average. a. Write a value-returning function that opens an input file named in File txt. You may "hard-code" the file name, i.e., you do not need to ask the user for the file name. The function should check the file state of the input file and return a value indicating success or failure. Main should check the returned value and if the file...
JAVA: create a program that reads all text files in a directory, calculates the occurrences of words, and saves the result in one single output text file. assume that you are in a directory called Desktop/programdirectory, where you have multiple text files. textfile1.txt : "how are you" textfile2.txt: "great thank you" textfile3.txt: "great to see you. see you later" Then, your output.txt should have: how: 1 are: 1 you: 4 great: 2 thank: 1 to: 1 see: 2 later: 1
In Python, do a basic encryption of a text file in the following manner. The program encrypt.py will read in the following text file and rearrange the lines in the file randomly and save the rearranged lines of txt to another file called encrypted.txt. It will also save another file called key.txt that will contain the index of the lines that were rearranged in the encrypted file, so for example if the 4th line from the original file is now...
NEED PYTHON PROGRAM CODE FOR THIS QUESTION Average of numbers Assume that a file containing a series of integers is named numbers.dat and exists on the computer’s disk. Design a program that calculates the average of all the numbers stored in the file.
(Python 3) Write a program that reads the contents of a text file. The program should then create a dictionary in which the keys are individual words found in the file and the values are the number of times each word appears and a list that contains the line numbers in the file where the word (the key) is found. Then the program will create another text file. The file should contain an alphabetical listing of the words that are...
Description: Create a program called numstat.py that reads a series of integer numbers from a file and determines and displays the name of file, sum of numbers, count of numbers, average of numbers, maximum value, minimum value, and range of values. Purpose: The purpose of this challenge is to provide experience working with numerical data in a file and generating summary information. Requirements: Create a program called numstat.py that reads a series of integer numbers from a file and determines...
Create a text file named “file1.txt” (by use of the notepad editor in Windows for instance) containing the following integer values, one per line: 12 5 13 56 90 52 82 52 Write a Java program that reads these values from the file and displays their sum on the screen.