Question

SOLVE IN PYTHON:Exercise #1: Design and implement a program (name it AssignGrades) that stores and processes...

SOLVE IN PYTHON:Exercise #1: Design and implement a program (name it AssignGrades) that stores and processes numeric scores for a class. The program prompts the users to enter the class size (number of students) to create a single-dimensional array of that size to store the scores. The program prompts the user to enter a valid integer score (between 0 and 100) for each student. The program validates entered scores, rejects invalid scores, and stores only valid scores in the array.

The program defines method printGrades() that takes a signal-dimensional array of integer scores as a parameter and processes the scores to print letter grades based on the following scale:

Grade is A if score >= 90 and score <= 100

Grade is B if score >= 80 and score <= 89

Grade is C if score >= 70 and score <= 79

Grade is D if score >= 60 and score <= 69

Grade is F if score < 60

Document your code and organized your output following these sample runs.

Sample run 1:

Class size: 5

Entered grades: 90, 67, 78, 89, 60

Student 0 score is 90 and grade is A

Student 1 score is 67 and grade is D

Student 2 score is 78 and grade is C

Student 3 score is 89 and grade is B

Student 4 score is 60 and grade is D

Sample run 2:

Class size: 3

Entered grades: 77, 50, 81

Student 0 score is 77 and grade is C

Student 1 score is 50 and grade is F

Student 2 score is 81 and grade is B

0 0
Add a comment Improve this question Transcribed image text
Answer #1
def determine_grade(score):
    if score < 60:
        letter = 'F'
    elif score < 70:
        letter = 'D'
    elif score < 80:
        letter = 'C'
    elif score < 90:
        letter = 'B'
    else:
        letter = 'A'
    return letter

def main():
    n = int(input("Class size: "))
    grades = input("Entered grades: ")
    lst = [int(x) for x in grades.split(", ")]
    for i in range(n):
        print("Student",i,"score is",lst[i],"and grade is",determine_grade(lst[i]))

main()

Note: Please comment below if you have any doubts

Please up vote the solution if it helped. Thanks!

Add a comment
Know the answer?
Add Answer to:
SOLVE IN PYTHON:Exercise #1: Design and implement a program (name it AssignGrades) that stores and processes...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • C++ Single Dimensional Arrays

    Exercise #1: Design and implement a program (name it AssignGrades) that stores and processes numeric scores for a class. The program prompts the users to enter the class size (number of students) to create a single-dimensional array of that size to store the scores. The program prompts the user to enter a valid integer score (between 0 and 100) for each student. The program validates entered scores, rejects invalid scores, and stores only valid scores in the array.  The program...

  • Student average array program

    Having a bit of trouble in my c++ class, was wondering if anyone can help.Write a program to calculate students' average test scores and their grades. You may assume the following input data:Johnson 85 83 77 91 76Aniston 80 90 95 93 48Cooper 78 81 11 90 73Gupta 92 83 30 68 87Blair 23 45 96 38 59Clark 60 85 45 39 67Kennedy 77 31 52 74 83Bronson 93 94 89 77 97Sunny 79 85 28 93 82Smith 85 72...

  • PSEUDOCODE and PYTHON source code! Program 4: Design (pseudocode) and implement (source code) a program (name...

    PSEUDOCODE and PYTHON source code! Program 4: Design (pseudocode) and implement (source code) a program (name it MinMaxAvg) to determine the highest grade, lowest grade, and the average of all grades in a 4-by-4 two-dimensional arrays of integer grades (representing 4 students’ grades on 4 tests). The program main method populates the array (name it Grades) with random grades between 0 and 100 and then displays the grades as shown below. The main method then calls method minMaxAvg()that takes a...

  • Write a program to calculate students’ average test scores and their grades. You may assume the...

    Write a program to calculate students’ average test scores and their grades. You may assume the following data: Johnson 85 83 77 91 76 Aniston 80 90 95 93 48 Cooper 78 81 11 90 73 Gupta 92 83 30 69 87 Blair 23 45 96 38 59 Clark 60 85 45 39 67 Kennedy 77 31 52 74 83 Bronson 93 94 89 77 97 Sunny 79 85 28 93 82 Smith 85 72 49 75 63 Use three...

  • Write a program to calculate students’ average test scores and their grades. You may assume the...

    Write a program to calculate students’ average test scores and their grades. You may assume the following data: Johnson 85 83 77 91 76 Aniston 80 90 95 93 48 Cooper 78 81 11 90 73 Gupta 92 83 30 69 87 Blair 23 45 96 38 59 Clark 60 85 45 39 67 Kennedy 77 31 52 74 83 Bronson 93 94 89 77 97 Sunny 79 85 28 93 82 Smith 85 72 49 75 63 Use three...

  • SOLVE IN PYTHON: Exercise #2: Design and implement a program (name it CompareArrays) that compares the...

    SOLVE IN PYTHON: Exercise #2: Design and implement a program (name it CompareArrays) that compares the content of 2 single-dimensional arrays of the same size. The program prompts the users to enter the array size. Then prompts the user to initialize each array with integer values. The program defines method Compare() that takes two signal-dimensional arrays of type integer. The method compares the content of the arrays and returns true (Boolean type) if the arrays store same values in the...

  • C++ Use C++ functions and build a program that does the most basic job all students...

    C++ Use C++ functions and build a program that does the most basic job all students have to contend with, process the grades on a test and produce a summary of the results. The big wrinkle is, it should be a multi-file program. -Requires three simple things: Figure out the best score of all scores produced Figure out the worst score of all scores produced Assign a letter grade for each score produced Complete this lab by writing three functions....

  • Java Question Method and 1 dimension arrays (20) YouTube ㄨ Electronics, Cars, Fashion, Co × Upload...

    Java Question Method and 1 dimension arrays (20) YouTube ㄨ Electronics, Cars, Fashion, Co × Upload Assignment: Program xy 9 Program3.pdf eduardo C Secure https://blackboard.kean.edu/bbcswebdav/pid-736390-dt-content-rid-2804166 1/courses/18SP CPS 2231 06/Program3.pdf Concepts: Methods and one dimensional Arrays Point value: 45 points Write a Java Class that reads students grades and assigns grades based on the following grading "curve .Grade is A if the score is greater than or equal to the highest score - 10 .Grade is B if the score is...

  • Write the definition of the class Tests such that an object of this class can store...

    Write the definition of the class Tests such that an object of this class can store a student's first name, last name, five test scores, average test score, and grade. (Use an array to store the test scores.) Add constructors and methods to manipulate data stored in an object. Among other things, your class must contain methods to calculate test averages, return test averages, calculate grades, return grades, and modify individual test scores. The method toString must return test data...

  • Write a program that performs the following: 1. Presents the user a menu where they choose...

    Write a program that performs the following: 1. Presents the user a menu where they choose between:              a. Add a new student to the class                           i. Prompts for first name, last name                           ii. If assignments already exist, ask user for new student’s scores to assignments              b. Assign grades for a new assignment                           i. If students already exist, prompt user with student name, ask them for score                           ii. Students created after assignment will need to...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT