The objective of this question is to generate and read files that contain a list of random numbers. Write a function that generates a file with following parameters: def fillFile(fileSize, fileName): The function should be called to generate files in the following sizes: fileSizes = [1000, 5000, 10000, 20000, 30000, 40000, 50000] The generated files can have names file1000, file 5000, file 10000, file20000, fi130000, file40000, file 50000. You can use random.randint(0.fileSize+1000) to generate a random number. Write another function that reads numbers inside of a file and returns a list. def readFile(fileName): The returned list contains the numbers stored in the file. At each call of fillFile and readFile, record the times before and after the function call as in following example (import time): start = time.time() fillFile(file Size, "file" + str(fileSize)) finish time.time() runTime = finish - start Record the run times of functions into a file named "fileStats.txt". The "fileStats.txt file should contain entries for run times as follows: fillFile nl, n2, n3, n4, n5, nó, n7 readFile nl, n2, n3, n4, n5, nó, n7 where nl, n2, n3, n4, n5, n6 and n7 are execution times for file sizes 1000, 5000, 10000, 20000, 30000, 40000, 50000.

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question

The objective of this question is to generate and read files that contain a list of random numbers. Write a function that generates a file with following parameters:

def fillFile(fileSize, fileName):

The function should be called to generate files in the following sizes:

fileSizes = [1000, 5000, 10000, 20000, 30000, 40000, 50000]

The generated files can have names file1000, file 5000, file 10000, file20000, fi130000, file40000, file 50000. You can use random.randint(0.fileSize+1000) to generate a random number.

Write another function that reads numbers inside of a file and returns a list.

def readFile(fileName):

The returned list contains the numbers stored in the file.

At each call of fillFile and readFile, record the times before and after the function call as in following example (import time):

start = time.time()

fillFile(file Size, "file" + str(fileSize))

finish time.time()

runTime = finish - start

Record the run times of functions into a file named "fileStats.txt". The "fileStats.txt file should contain entries for run times as follows:

fillFile nl, n2, n3, n4, n5, nó, n7 readFile nl, n2, n3, n4, n5, nó, n7

where nl, n2, n3, n4, n5, n6 and n7 are execution times for file sizes 1000, 5000, 10000, 20000,

30000, 40000, 50000.

Submit your program code and filleStats.txt in ZIP file together with the solutions of other programs. 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
Knowledge Booster
Function Arguments
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education