Print out the average score accurate to two decimal places

Assignment Help Python Programming
Reference no: EM13825406

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.

Reference no: EM13825406

Questions Cloud

Discuss how tirgaran ltd should account for these costs : Discuss how Tirgaran Ltd should account for these costs. Provide journal entries with an explanation of why these are the appropriate entries
Raise money for the event : Every runner is required to solicit sponsors to help raise money for the event. There are two types of sponsors - corporate and personal.Design a second table that will store data about the sponsors for each runner.1.Make a list of the field names an..
File sharing program : Explain what your process was and how the experiment went. Were you successful? What did you learn from the experience ?Experiment choice #1:  File Sharing Program Download a current version a file sharing program such as BitTorrent and use it to dow..
Law of death penalty in the united states : The US Supreme Court has often dealt with the question of whether the death penalty is cruel and unusual punishments, sometimes seeming to hold that it is cruel and unusual punishment and sometimes seeming to hold that particular ways of administe..
Print out the average score accurate to two decimal places : print out the average score accurate to two decimal places.
What type of noncash scheme is baker most likely : Baker is an auditor for ABC Company. As part of a proactive fraud audit (using CAATs), Baker runs the following tests: (1) a review of the sales register for dormant customer accounts that posted a sale within the last two months; Taken together, wha..
How protocols support business processes : Define upper layer applications.Explain how the application layer manages distributed applications and their protocols.Describes the application protocols associated with these services
Discuss the role of an accountant in a business organization : Discuss the role of an accountant in a business organization
Explian about a firm operating monopolistically in a market : The problem belongs to Economics, mainly to Micro-economics and it converse about a firm operating monopolistically in a competitive market ends up with super-normal profit with advertisement.

Reviews

Write a Review

Python Programming Questions & Answers

  Improve the readability and structural design of the code

Improve the readability and structural design of the code by improving the function names, variables, and loops, as well as whitespace. Move functions close to related functions or blocks of code related to your organised code.

  Write a loop that counts the number of space

Write a loop that counts the number of space characters in a string. Recall that the space character is represented a

  Programmer does not have to use the def statement

Unlike Z+-, the programmer does not have to use the DEF statement to create a variable. Instead, the programmer can simply use the variable. The first use of the variable creates it and initializes it to 0.

  Write a function rmduplic(l), where l is any list

Write a function rmDuplic(L), where L is any list. The function should return a list M that contains the same items as L, except that repetitions (duplicates) have been removed: only the first occurrence of each entry is kept (i.e., order is prese..

  Program that creates a dictionary containing

Write a program that creates a dictionary containing the U.S. states as keys and their capitals as values. The program should then randomly quiz the user by displaying

  Most popular name would be the one with the biggest number

the program will ask you to insert the year that the user is interested in, then ask the gender that the user is interested in, and print out the most popular names corresponding to the year and gender. FYI, the number on the right represents how man..

  Write a function trans(m) which returns the transpose

Write a function trans(M) which returns the transpose of an n-by-n matrix M. The matrix M is represented by a list of n lists, each of length n. Transposing M means that each M[i][j] is swapped (once!) with M[j][i].

  1 one factor that leads to a decline in biodiversity is the

1. one factor that leads to a decline in biodiversity is the introduction of non-native species. however most species

  Improve the structural design - haunted house game

List the things you changed and the purpose of changing it. Good reasons include making code easier to read and easier to navigate when modifying it.

  Output the starting position and length

X Strings: Input a string. Output the starting position and length of the first occurrence of the longest substring of capital Xs in that string. The first letter is in position 1.

  The program should allow the student

The program should allow the student to enter the answer. If the answer is correct, a message of congratulations should be displayed. If the answer is incorrect, a message showing the correct answer should be displayed.

  Assignment brief you are tasked with improving the code for

assignment brief you are tasked with improving the code for the haunted house game. please read the associated hand-out

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd