Computers and Technology

There was a mistake in entering grades on Canvas. We need your help writing a Python script that can help us maintain the class roster. The functionalities you need to implement are explained below. For each of the functionalities, you may want to implement a separate function.

Adding a student to the roster:
When you receive the "add NAME GRADE" command, you need to add one student with the name "NAME" and the grade "GRADE" to the roster. For example, "add Simon 20" will add Simon to the roster and his grade will be 20. If the entered grade was greater than 100, or if the student’s name is already on the roster, then don’t add the student to the roster and instead print "Failed to add NAME", with NAME being the name of the student you were asked to add to the roster. If adding the student was successful, you will print "Added NAME", with NAME being the name of the student you just added.
Updating the grade of an existing student:
When you receive the "update NAME GRADE" command, you will have to check if the student with the name "NAME" exists in the roster. If so, update their grade to "GRADE" and print "Updated NAME’s grade" with NAME being the name of the student. Otherwise, print "NAME does not exist in the roster".

Printing the roster:
When you receive the "print" command, you need to print the entire roster in the output in the same order that you added students to the roster. For example, if we have {‘Narges’: 0, ‘Benedict’: 1} on our roster, it will print:
Narges: 0
Benedict: 1

Exiting the program:
When you receive the "exit" command, you will terminate the program and stop receiving inputs from the user.
Sample Input 1:

add narges 0
print
exit
Sample Output 1:

Added narges
narges: 0
Sample Input 2:

add Benedict 1
add Rafael 11
add michael 111
exit
Sample Output 2:

Added Benedict
Added Rafael
Failed to add michael
Sample Input 3:

add Katelyn 99
print
update Katelyn 100
print
update Rafael 98
exit
Sample Output 3:

Added Katelyn
Katelyn: 99
Updated Katelyn's grade
Katelyn: 100
Rafael does not exist in the roster
Sample Input 4:

add Ben 10
add Bao 11
update bao 12
print
update Bao 12
print
exit
Sample Output 4:

Added Ben
Added Bao
bao does not exist in the roster
Ben: 10
Bao: 11
Updated Bao's grade
Ben: 10
Bao: 12
Sample Input 5:

update Yama 80
add Yama 80
add Yama 90
update Yama 100
print
exit
Sample Output 5:

Yama does not exist in the roster
Added Yama
Failed to add Yama
Updated Yama's grade
Yama: 100

answer
Answers: 3

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 23:00, brooklynmikestovgphx
Suppose s, t, and w are strings that have already been created inside main. write a statement or statements, to be added to main, that will determine if the lengths of the three strings are in order by length, smallest to largest. that is, your code should determine if s is strictly shorter than t, and if t is strictly shorter than w. if these conditions hold your code should print (the boolean value) true. if not, your code should print false. (strictly means: no ties) example: if s, t, and w are "cat", "hats", and "skies" your code should print true - their lengths are 3-4-5; but if s, t, and w are "cats" "shirt", and "trust", then print false - their lengths are 4-5-5 enter your code in the box below
Answers: 2
image
Computers and Technology, 23.06.2019 00:30, lm18618
Which one of the following is considered a peripheral? a software b mouse c usb connector d motherboard
Answers: 2
image
Computers and Technology, 23.06.2019 06:30, Knownothing
When early motion pictures played in movie theaters, they were often accompanied by live organ or piano music. which of the following are the most likely reasons that this happened? (select all that apply). the music was provided to distract audience members from the loud sounds made when filmstrips were changed. the music accompanied the movies because the movies were silent and audiences were used to hearing music during plays in theaters. the music usually was played before, and sometimes after the movie, as an alternative form of entertainment. the music viewers to interpret the dramatic action in the films.
Answers: 2
image
Computers and Technology, 23.06.2019 09:00, amberpublow7
Which best describes the role or restriction enzymes in the analysis of edna a. to break dna into fragments that vary in size so they can be sorted and analyzed b. to amplify small amounts of dna and generate large amounts of dna for analysis c. to purify samples of dna obtained from the environment so they can be analyzed d. to sort different sizes of dna fragments into a banding pattern that can be analyzed
Answers: 1
Do you know the correct answer?
There was a mistake in entering grades on Canvas. We need your help writing a Python script that can...

Questions in other subjects:

Konu
Mathematics, 07.01.2021 01:00
Konu
Mathematics, 07.01.2021 01:00