subject

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

ansver
Answers: 3

Another question on Computers and Technology

question
Computers and Technology, 22.06.2019 03:00
Which action describes an aspect of technological design?
Answers: 1
question
Computers and Technology, 22.06.2019 05:10
Suppose we have a byte addressable computer that has a 32-byte cache with 8 bytes per block. the memory address is 8 bits long. the system accesses memory addresses (in hex) in this exact order: 6e, b9, 17, e0, 4e, 4f, 50, 91, a8, ab, ad, 93, and 94. (a) assuming the cache is direct mapped, what memory addresses will be in cache block 2 after the last address has been accessed? (b) assuming the cache is direct mapped, what is the hit ratio for the entire memory reference sequence given, assuming the cache is initially empty? (c) assuming the cache is 2-way set associative with a lru replacement policy, what is the hit ratio?
Answers: 3
question
Computers and Technology, 22.06.2019 23:00
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
question
Computers and Technology, 23.06.2019 04:20
Which network media uses different regions of the electromagnetic spectrum to transmit signals through air? uses different regions of the electromagnetic spectrum to transmit signals through air.
Answers: 2
You know the right answer?
There was a mistake in entering grades on Canvas. We need your help writing a Python script that can...
Questions
Questions on the website: 13722361