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

Other questions on the subject: Computers and Technology

image
Computers and Technology, 23.06.2019 00:10, witerose701
Write a function so that the main0 code below can be replaced by the simpler code that calls function mphandminutes tomiles0. original main0 int main) l double milesperhour-70.0; double minutestraveled = 100.0; double hourstraveled; double milestraveled; hourstraveled = minutestraveled / 60.0; milestraveled = hourstraveled * milesperhour; cout < "miles" 2 using namespace std; 4 /* your solution goes here/ 6 int maino 1 test passed 7 double milesperhour 70.0 all tests passed 8 double minutestraveled 100.0; 10 cout < < "miles: " < < mphandminutestomiles(milesper-hour, minutestraveled) < < endl; 12 return 0; 13
Answers: 1
image
Computers and Technology, 23.06.2019 09:00, paulusl19
The first screen you see when you open word2016 what is called?
Answers: 1
image
Computers and Technology, 23.06.2019 10:20, chonawilson4
Suppose there is a relation r(a, b, c) with a b+-tree index with search keys (a, b).1. what is the worst-case cost of finding records satisfying 10 < a < 50 using this index, in terms of the number of records n1, retrieved and the height h of the tree? 2. what is the worst-case cost of finding records satisfying 10 < a < 50 and 5 < b < 10 using this index, in terms of the number of records n2 that satisfy this selection, as well as n1 and h defined above? 3. under what conditions on n1 and n2, would the index be an efficient way of finding records satisfying the condition from part (2)?
Answers: 1
image
Computers and Technology, 23.06.2019 12:00, anamatiascamaja
If you embed a word table into powerpoint, what happens when you make edits to the embedded data? a. edits made to embedded data change the data in the source file; however, edits made to the source file will not be reflected in the embedded data. b. edits made to embedded data will change the data in the source file, and edits made to the source file will be reflected in the embedded data. c. edits made to embedded data don't change the data in the source file, nor will edits made to the source file be reflected in the embedded data. d. edits made to embedded data don't change the data in the source file; however, edits made to the source file will be reflected in the embedded data.
Answers: 1
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 in other subjects:

Konu
Mathematics, 30.03.2021 23:00