Question
HW8 Create a script must define 4 functions random_number_file_create lines_print lines_count total_numbers_in_file random_number_file_create This functions must have the following header def random_number_file_create(min, max, filename, entries):
HW8
Create a script must define 4 functions
random_number_file_create
lines_print
lines_count
total_numbers_in_file
random_number_file_create
This functions must have the following header
def random_number_file_create(min, max, filename, entries):
This function must create a file where each line has a pseudorandom number. Each of these numbers must be integers between the values of the parameters min and max. The name of the file is given by the parameter filename. The number of lines in the file is given by the parameter entries. The function must close the file after it has written all the values.
lines_print
This functions must have the following header
def lines_print(filename):
This function must print each line of the file. There should be no blank lines between the lines of the file. The function must close the file after it has printed all the lines.
lines_count
This functions must have the following header
def lines_count(filename):
This function must count the number of lines in the file and return that total. The function must close the file after it has read all the lines.
total_numbers_in_file
This functions must have the following header
def total_numbers_in_file(filename):
This function must calculate the total of all the numbers in the file and return that total. The function must close the file after it has read all the lines.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started