Print out the average score accurate to two decimal


PROGRAM A:

This program should use a main function and another function named makelist as follows:

in main, generate a random integer that is greater than 5 and less than 13.

print this number on its own line.

call the makelist function with the random integer as sole argument.

inside the makelist function:

make an empty list.

use a loop to append to the list a number of elements equal to the random integer argument. All new list elements must be random integers ranging from 1 to 100, inclusive. Duplicates are okay.

return the list to main.

back in main, catch the returned list and sort it.

finally, use a for loop to display the sorted list elements, all on one line, separated by single spaces.

PROGRAM B:

Use the text file named scores.txt (supplied). It contains a number of integer test scores, one per line. Your program should use a main function and another function named showscores as follows:

in main, create an empty list.

open the file named scores.txt.

use a while loop that can detect the end of file to read the scores, and add them to the list.

close the file.

call the showscores function with the list of scores as sole argument.

inside the showscores function:

process the list of scores. NOTE: your instructor will use a modified version of scores.txt with different scores and a different number of scores. Your code should be capable of handling this.

print out the average score accurate to two decimal places.

Request for Solution File

Ask an Expert for Answer!!
Python Programming: Print out the average score accurate to two decimal
Reference No:- TGS01105688

Expected delivery within 24 Hours