GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

For the code below, what are the overridden method(s) (check…

For the code below, what are the overridden method(s) (check all that apply)?: class Employee (object):         def __init__(self, name, email):                  self.name = name                  self.email = email         def chgEmail (self, newEmail):                  self.email = newEmail + ‘.com’                  return True   class Manager (Employee):           def __init__(self, name, email, salary):                  super().__init__(name, email)                  self.salary = salary        def chgEmail(self, newEmail):                 self.email = newEmail   class Worker (Employee):            def __init__(self, name, email, hourly):                 super().__init__(name, email)                 self.hourly = hourly           # executable code that follows the code above: e1 = Employee (‘John Miller’, ‘jMiller@gmail.com’) e2 = Employee (‘Jane Bradley’, ‘jbradley@tesla.com’) w1 = Worker   (‘Karina Schmidt’, ‘kschmidt@tesla’, 18.50) w2 = Worker   (‘Juan MacMaster’, ‘jmacmaster@gmail.com’, ‘17.25’) m1 = Manager  (‘Elon Musk’, ’emusk@tesla.com’, 650000) m2 = Manager  (‘Erica Contreras’, ‘econtreras@gmail.com’, 110000)

Read Details

With regards to comma separated value files such as .csv and…

With regards to comma separated value files such as .csv and .tsv, what is a delimiter? Top of Form

Read Details

What do you understand by CRUD operations

What do you understand by CRUD operations

Read Details

What will this code print? ”’ class Demo:    def __enter__(…

What will this code print? ”’ class Demo:    def __enter__(self):        print(“Enter”)        return self    def __exit__(self, *args):        print(“Exit”) with Demo():    print(“Inside”) ”’

Read Details

What does .throw() do in a Python generator?

What does .throw() do in a Python generator?

Read Details

What do you understand about the between the 3 relationships…

What do you understand about the between the 3 relationships – Composition, Association and Aggregation ? Give ONE example for each type of relationship.  Which one shows a tight relationship between objects and which one shows a loose relationship between its objects.   

Read Details

Iterators support the iter() function 

Iterators support the iter() function 

Read Details

Iterators support the iter() function

Iterators support the iter() function

Read Details

When you use a yield statement in a generator function, it c…

When you use a yield statement in a generator function, it causes the function execution to be (skipped / aborted / suspended), returning the yielded value to the caller.

Read Details

Create Python code to process data on IT courses held in a l…

Create Python code to process data on IT courses held in a list of lists (i.e. a two dimensional list) like the following:  courseList = [ [‘IT109’, ‘001’, ‘TR720’, ‘Hashmi’, ’29’], [‘IT109’, ‘002’, ‘MW1030’, ‘Shuman’, ’28’], [‘IT109’, ‘003’, ‘TR720’, ‘Vosoughi’, ’24’], … ] # a variable number of other sublists follow You should assume the above variable “courseList” is available in your answer code and not have to be retyped into your answer.  Each sublist in courseList consists of five data items.  Your code must convert the above list into JSON formatted data and write it to a file called “JSONCourseData.txt”.  To do that the above sublists must be converted into a list of dictionaries, each sublist (course line) becoming a dictionary and then appended to a list.  The sublist (course) dictionary must have three labelled data elements:  “number”, which consists of a concatenation of the course number and section, “instructor”, and “registrants”.  The resulting dictionary for the first sublist in the courseList example above should look like this: courseDict = {“number”: “IT109-001”, “instructor”: “Hashmi”, “registrants”: “29”} One of these dictionaries is created for each sublist, then appended to a list.  When done, the entire list of dictionaries is written to the file “JSONCourseData.txt”.  Be sure to use the appropriate Python json code to create the correct format. Note that nothing needs to be printed, but be sure to name the list of dictionaries “allCourses”.   The estimated number of lines of code needed to do the above is in the 10 – 15 range.  

Read Details

Posts pagination

Newer posts 1 … 26,550 26,551 26,552 26,553 26,554 … 99,350 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top