Write a program that allows the user to enter a series of exam scores. The number of scores the user can enter is not fixed; they can enter any number of scores they want. The exam scores can be either integers or floats. Then, once the user has entered all the scores they want, your program will calculate and print the average of those scores. After printing the average, the program should terminate.
You need to use a while loop to allow the user to enter numbers, one at a time, until some numeric sentinel value is entered. I recommend having a sentinel like 9999, something unlikely to be confused with an exam score. If the user enters a score < 0 or > 100 that is not the sentinel value then that score is to be rejected. Each time a legit score is entered, however, it should be added (appended) to a list.
Once the user has entered all the numbers they want, calculate and display the average of the scores rounded to 1 decimal place.
To get full credit, you need to do the following.
Here is a possible program run using four scores. The sentinel value here is 9999. You may choose your own wording for the prompt string and output string.
If the user enters a bogus score, your output should look similar this.
Note: Could you plz go this code and let me know if
u need any changes in this.Thank You
_________________
list = []
# initialize sum and counter
sum = 0.0
cnt = 0
avg = 0.0
SENTINEL = 9999
# To take input from the user,
n = float(input('Enter n: '))
# This loop continues to iterate until the user enters 9999
while n != 9999:
if n < 0 or n > 100:
print '** Invalid Score **'
else:
list.append(n)
cnt = cnt + 1
n = float(input('Enter n: '))
# calculating the sum in list elements
for i in list:
sum = sum + i
# calculating average
avg = sum / cnt
# Displaying output
print 'Average:%.1f' % avg
_____________________
Output :
__________________
Screen Shot of program( Am providing the screen shot of program bec,the indentation is important in python other u may get error while executing program)
_____________Thank You
Write a program that allows the user to enter a series of exam scores. The number...
In C++ 2. Write a program that allows the user to enter a series of positive numbers between 1 and 100 and displays the smallest and largest of the numbers entered. The program should not store the numbers that were entered, only keep track of the smallest and largest ones. The program should continue accepting numbers until the value 0 is entered and then display the results. If a number out of range is entered, tell the user it is...
Write a program named ClassifyScores that classifies a series of scores entered by the user into ranges (0-9, 10-19, and so forth). The scores will be numbers between 0 and 100. Design and implement a program to prompt the user to enter each score separately. If the score is within the correct range, then increment the appropriate range If the score entered is greater than 100, display an error message, ignore the incorrect score, and prompt for the user to...
This program will ask the user to enter a number of players, then ask the user for each player's name and score. Once all of the players have been entered, the program will display a bar chart with each of their scores scaled as a percentage of the maximum score entered. See below for details on exactly how this should work - an example transcript of how the program should work is shown below (remember that values entered by the...
[JAVA/chapter 7] Assignment: Write a program to process scores for a set of students. Arrays and methods must be used for this program. Process: •Read the number of students in a class. Make sure that the user enters 1 or more students. •Create an array with the number of students entered by the user. •Then, read the name and the test score for each student. •Calculate the best or highest score. •Then, Calculate letter grades based on the following criteria:...
Question: - write a C++ program that asks user to enter students' quiz scores, calculate the total score for each students and average for all. Note: - number of students: 1 through 5. That is, at least one student and up to 5. - number of quizes: 8 through 10. That is, at least 8 quizes and up to 10. - quiz score range: 0 through 100. - when entering quiz scores, if user enters -1, that means the user...
All scores entered into the program must be validated. In order to do this, the program needs to know the range of point available, from zero to the maximum possible score (MaxScore). To do this, implement the form's load-event handler. It should use an input box to get the MaxScore (i.e. total points available) value from the user. This MaxScore value must be validated, using a separate function, as an integer that is greater than zero before being accepted. The...
Create a Java program which asks the user how many names they want to enter. The program should then instantiate an array that will hold this many names. The main method should call a method, getNames() to allow the user to enter the names. A for loop should be used in this method. Once the names are entered, the main method should call another method displayNames() which will use a while loop to display the names entered.
14.3: More Sentences Write a program that allows a user to enter a sentence and then the position of two characters in the sentence. The program should then report whether the two characters are identical or different. When the two characters are identical, the program should display the message: <char> and <char> are identical! Note that <char> should be replaced with the characters from the String. See example output below for more information. When the two characters are different, the...
Write a Python program that asks the user to type in their three quiz scores (scores between 0 and 100) and displays two averages. The program should be written so one function gets the user to input a score, another function takes the three scores and returns the average of them. And another function takes the three scores and averages the two highest scores (in other words, drops the lowest). Each of these functions should do the computation and return...
Write a program that will ask the user to enter 4 quiz scores. These scores should be from 0 to 100. Use a procedure and pass by reference to get these scores. Write a function that will find the lowest score. This score will be sent back through the function call. You still need to pass the scores by value to this function. Write a function that will calculate the average score. This value will be sent back to main...