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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!