GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

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

What’s a generator function in Python?

What’s a generator function in Python?

Read Details

Name all key differences between JSON and CSV file formats….

Name all key differences between JSON and CSV file formats. Check all that apply.

Read Details

Below is a definition of a polymorphic function and a class….

Below is a definition of a polymorphic function and a class. What will be the outcome of the following code? class Audio(object):     def audio_sound(self):          print(‘Boo Boo!’) def makeSound(animalType):     animalType.sound() #function call a = Audio() makeSound(a) #outcome of this line

Read Details

 In Python, a class can be derived from multiple base classe…

 In Python, a class can be derived from multiple base classes, a feature known as

Read Details

For a class called Date defined as follows:     class Date(…

For a class called Date defined as follows:     class Date(object):             currentYear = 2022             def __init__ (self, month, day):                   self.month = month                 self.day = day           def __str__(self):                 return (self.month+”/”+self.day+”/”+str(Date.currentYear)What will be the display output of the following code?d1 = Date(“01”, “23”)Date.currentYear += 2print(d1)

Read Details

Which of the following is a valid definition of ‘Superman’ c…

Which of the following is a valid definition of ‘Superman’ class – a subclass of Superhero?

Read Details

Longhorn paid Cattleman’s Steakhouse $[a] to acquire all of…

Longhorn paid Cattleman’s Steakhouse $[a] to acquire all of its assets and liabilities. The balance sheet of Cattleman’s shows assets of $98,400 and liabilities of $[c]. The fair value of the assets is $[b] and the fair value of its liabilities is $[c]. What amount should Longhorn record as goodwill on this purchase? 

Read Details

A truck was purchased on April 1, 2024 for $85,000. The truc…

A truck was purchased on April 1, 2024 for $85,000. The truck is estimated to have a salvage value of $5,000 and a useful life of 125,000 miles. It was driven 22,000 miles in 2024 and 28,000 miles in 2025. What is the depreciation expense for 2025?

Read Details

Please share your favorite thing you learned this semester!…

Please share your favorite thing you learned this semester! (Note: You will only earn a point if you share your favorite thing).

Read Details

Posts pagination

Newer posts 1 … 25,943 25,944 25,945 25,946 25,947 … 98,742 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top