Question

In: Computer Science

This exercise is a bit more complicated and will be a review of what we’ve learned...

This exercise is a bit more complicated and will be a review of what we’ve learned about lists and dictionaries. The aim of this exercise is to make a gradebook for a group of students.

Follow these steps:

  1. Consider a list of dictionaries in the following format:

students = {

"lloyd": {

"name": "Lloyd",

"homework": [90.0,97.0,75.0,92.0],

"quizzes": [88.0,40.0,94.0],

"tests": [75.0,90.0]

},

"alice": {

"name": "Alice",

"homework": [100.0, 92.0, 98.0, 100.0],

"quizzes": [82.0, 83.0, 91.0],

"tests": [89.0, 97.0]

},

"tyler": {

"name": "Tyler",

"homework": [0.0, 87.0, 75.0, 22.0],

"quizzes": [0.0, 75.0, 78.0],

"tests": [100.0, 100.0]

}

}

  1. Pass this dictionary as a parameter to your functions, and for each student in the dictionary, output in a well-designed manner the following data:
  • name
  • homework scores
  • quiz scores
  • test scores
  • average homework scores
  • average quiz scores
  • average test scores
  • letter grade
  • assume:

      A – 100% - 90%

      B – 90% - 80%

      C – 80% - 70%

      D – 70% - 60%

      F – 59% - below

  • an average grade for the class

Your program should work for any list of students, i.e. your solution should be general in that it takes in any dictionary in this format of any length, process the data, and return the results. You should test it with this input, as well as input you make up. I will also test it with both this input as well as another set of data that is formatted similarly.

Solutions

Expert Solution

Code:-

for name,dic in students.items():

  print("name:- "+name)

  print("homework scores:-",end=" ")

  print(students[name]["homework"])

  print("quiz scores:-",end=" ")

  print(students[name]["quizzes"])

  print("test scores:-",end=" ")

  print(students[name]["tests"])

  hw_score_total=0

  quiz_score_total=0

  test_score_total=0

  for i in students[name]["homework"]:

    hw_score_total +=i

  for j in students[name]["quizzes"]:

    quiz_score_total +=j

  for k in students[name]["tests"]:

    test_score_total +=k

  print("average homework scores:-",hw_score_total/len(students[name]["homework"]))

  print("average quiz scores:-",quiz_score_total/len(students[name]["quizzes"]))

  print("average test scores:-",test_score_total/len(students[name]["tests"]))

  grade=''

  percent = ((hw_score_total+quiz_score_total+test_score_total)*100/((len(students[name]["homework"]) + len(students[name]["quizzes"]) + len(students[name]["tests"]))*100))

  if(percent >=90 and percent<=100):

    grade = 'A'

  elif(percent >=80 and percent<90):

    grade = 'B'

  elif(percent >=70 and percent<80):

    grade = 'C'

  elif(percent >=60 and percent<70):

    grade = 'D'

  else:

    grade = 'F'

  print("letter grade:- ",grade)

  print(" ")

Screenshots have been added for additional clarity


Related Solutions

We’ve seen in this lab exercise that proteins can be involved in more than one biological...
We’ve seen in this lab exercise that proteins can be involved in more than one biological process or KEGG pathway. Based on what you’ve learned in Cell Biology Lecture or Lab, describe a protein that has a role in multiple processes or pathways. Include in your answer the name of the protein and in which pathway or process it is involved.
Technology is becoming more and more complicated every year. As technology becomes more complicated new security...
Technology is becoming more and more complicated every year. As technology becomes more complicated new security measures are required in order to protect individuals from theft. Most people do not understand how simple devices such as debit/card cards and online bill pay work, so how can they effectively protect themselves from theft. I believe we have reached a point in technology where most of our financial transactions are done over wire and not actually completed using tangible currency. In-fact only...
We’ve learned in class that most of the gravitating mass in the Milky Way is in...
We’ve learned in class that most of the gravitating mass in the Milky Way is in some form of “dark matter”. In a few paragraphs below, briefly describe how we measure the presence and properties of this dark matter in our galaxy, and discuss at least one possible 'solution' to the mystery of what dark matter is.
Based on the notations we’ve learned in class and being used in this exam, which of...
Based on the notations we’ve learned in class and being used in this exam, which of the following genotypes is a correct way to write out an individual having Wilson’s disease and red green color blindness? SELECT ALL ATP7B/atp7b XAXa ATP7B/atp7b XAY atp7b /atp7b XaY atp7b /atp7b XaXa
Why is justice in healthcare more complicated than just doing what is fair?
Why is justice in healthcare more complicated than just doing what is fair?
Analyze the exercise of judicial review. What is judicial review, what are its origins, and why...
Analyze the exercise of judicial review. What is judicial review, what are its origins, and why has it remained an unquestioned power of the courts for so long? Provide some examples of notable uses of judicial review in Supreme Court history. Response length requirement: 350 words or more
1. As we’ve learned, a third market – the Labor Market – typically does not reach...
1. As we’ve learned, a third market – the Labor Market – typically does not reach an equilibrium where supply of labor equals demand for labor. What do we call the “normal” unemployment rate that persists even when wages have [incompletely] adjusted? 2. Say that businesses in the economy collectively think that the markets in which they sell their goods will soon experience increasing demand. In the loanable funds market, (a) which curve(s) do you expect to be affected, and...
Based upon a bit of research, what you've learned in your prior coursework, or any observations...
Based upon a bit of research, what you've learned in your prior coursework, or any observations from your industry experiences, what are some of the key strategic functions of the CFO in the current world of business? How does the role of the CFO differ from that of a company controller? Does every company require a full-time CFO? Be sure to include support or examples in your comments.
Review prisoners dilemma and comment on lessons learned.
Review prisoners dilemma and comment on lessons learned.
Submit a short review of what you learned by teaching others the importance of a Project...
Submit a short review of what you learned by teaching others the importance of a Project management. Topic - Technique. Include what you would do the same, differently or recommendation you would make to yourself for future "teaching" opportunities.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT