Quantcast

A community for students. Sign up today!

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

Syamantak

  • one year ago

Fill in the code for setGrade,getGrade,setPset and getPset in Python

  • This Question is Closed
  1. Syamantak
    • one year ago
    Best Response
    You've already chosen the best response.
    Medals 0

    The code is : class courseInfo(object): def __init__(self, courseName): self.courseName = courseName self.psetsDone = [] self.grade = "No Grade" def setPset(self, pset, score): self.psetsDone.append((pset, score)) def getPset(self, pset): for (p, score) in self.psetsDone: if p == pset: return score def setGrade(self, grade): if self.grade == "No Grade": self.grade = grade def getGrade(self): return self.grade class edx(object): def __init__(self, courses): self.myCourses = [] for course in courses: self.myCourses.append(courseInfo(course)) def setGrade(self, grade, course="6.01x"): """ grade: integer greater than or equal to 0 and less than or equal to 100 course: string This method sets the grade in the courseInfo object named by `course`. If `course` was not part of the initialization, then no grade is set, and no error is thrown. The method does not return a value. """ # fill in code to set the grade pass def getGrade(self, course="6.02x"): """ course: string This method gets the grade in the the courseInfo object named by `course`. returns: the integer grade for `course`. If `course` was not part of the initialization, returns -1. """ # fill in code to get the grade pass def setPset(self, pset, score, course="6.00x"): """ pset: a string or a number score: an integer between 0 and 100 course: string The `score` of the specified `pset` is set for the given `course` using the courseInfo object. If `course` is not part of the initialization, then no pset score is set, and no error is thrown. """ # fill in code to set the pset pass def getPset(self, pset, course="6.00x"): """ pset: a string or a number score: an integer between 0 and 100 course: string returns: The score of the specified `pset` of the given `course` using the courseInfo object. If `course` was not part of the initialization, returns -1. """ # fill in code to get the pset pass edX = edx( ["6.00x","6.01x","6.02x"] ) edX.setPset(1,100) edX.setPset(2,100,"6.00x") edX.setPset(2,90,"6.00x") edX.setGrade(100) for c in ["6.00x","6.01x","6.02x"]: edX.setGrade(90,c)

  2. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Ask a Question
Find more explanations on OpenStudy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.