GradePack

    • Home
    • Blog
Skip to content
bg
bg
bg
bg

GradePack

Someone who recognizes and resolves difficult situations con…

Someone who recognizes and resolves difficult situations constructively is a(n) _____.

Read Details

What is a syntactically correct way to update the key-value…

What is a syntactically correct way to update the key-value pair (1, ‘one’) in the following dictionary number? number = {1: ‘one’, 3: ‘THREE’, 90: ‘NINETY’}

Read Details

A hypothetical class called “MyClass” has a method called ‘e…

A hypothetical class called “MyClass” has a method called ‘equals’ with this signature line: def equals (self, in_obj): What code should be added to that method to check whether the input object is the same object as the MyClass object in which the method is being executed?

Read Details

Given the following class code that you should assume will c…

Given the following class code that you should assume will correctly execute (ignore any minor syntax errors): class Ticket (object):         ticketCount = 0         def __init__ (self, name, event):                 self.serialNumber = Ticket.ticketCount               Ticket.ticketCount += 1                 self.cust_name = name                 self.event = event         def __str__ (self):                 return (‘Tick#’ + str(self.serialNumber) + ‘ – ‘ + self.cust_name + ‘ – ‘ + self.event)         def equalTick (self, t_obj):                 if self == t_obj:                         return True, ‘dupe ticket’                 if not isinstance (t_obj, Ticket):                         return False, ‘Object not type Ticket’                 return (str(self.serialNumber) == str(t_obj.serialNumber) and                         str(self.event) == str(t_obj.event), ‘comparison done’ )# global code ———————————————-t1 = Ticket (‘K. Ball’, ‘GMU Basketball’)t2 = Ticket (‘Tom Brady’, ‘Pats Game’)t3 = Ticket (‘Gene Shuman’, ‘Nats Game’)t4 = Ticket (‘E. Musk’, ‘SpaceX Launch’)t5 = Ticket (‘K. Ball’, ‘GMU Basketball’)t6 = Ticket (‘A. Trebek’, ‘Jeopardy Audience’)What is the display output of t1 == t5 ?

Read Details

View the following class definition then answer the question…

View the following class definition then answer the question that follows. class Date ( ):       currentYear = 2024         def __init__ (self, month, day, descr):                 self.month = month                 self. day = day                 self.descr = descr         def __str__ (self):                 return str(self.month) + ‘/’ + str(self.day) + ‘/’ + str(self.year) + ‘ – ‘ + self.descr What changes can be done to make the above code function correctly by printing a 2024 date with the Python ‘print’ statement?  Check the statements that, each executed by itself (that is, not in combination with another statement), would make the code correctly execute.

Read Details

Given the following class code that you should assume will c…

Given the following class code that you should assume will correctly execute (ignore any minor syntax errors): class Ticket (object):         ticketCount = 1         def __init__ (self, name, event):                 self.serialNumber = Ticket.ticketCount               Ticket.ticketCount += 1                 self.cust_name = name                 self.event = event         def __str__ (self):                 return (‘Tick#’ + str(self.serialNumber) + ‘ – ‘ + self.cust_name + ‘ – ‘ + self.event)         def equalTick (self, t_obj):                 if self == t_obj:                         return True, ‘dupe ticket’                 if not isinstance (t_obj, Ticket):                         return False, ‘Object not type Ticket’                 return (str(self.serialNumber) == str(t_obj.serialNumber) and                         str(self.event) == str(t_obj.event), ‘comparison done’ )# global code ———————————————-t1 = Ticket (‘K. Ball’, ‘GMU Basketball’)t2 = Ticket (‘Tom Brady’, ‘Pats Game’)t3 = Ticket (‘Gene Shuman’, ‘Nats Game’)t4 = Ticket (‘E. Musk’, ‘SpaceX Launch’)t5 = Ticket (‘K. Ball’, ‘GMU Basketball’)t6 = Ticket (‘A. Trebek’, ‘Jeopardy Audience’)t7 = ‘Tick#7 – Gene Shuman – Nats Game’What is the display output of t3.equalTick(t7) ?

Read Details

Given the following class code that you should assume will c…

Given the following class code that you should assume will correctly execute (ignore any minor syntax errors): class Ticket (object):         ticketCount = 0         def __init__ (self, name, event):                 self.serialNumber = Ticket.ticketCount               Ticket.ticketCount += 1                 self.cust_name = name                 self.event = event         def __str__ (self):                 return (‘Tick#’ + str(self.serialNumber) + ‘ – ‘ + self.cust_name + ‘ – ‘ + self.event)         def equalTick (self, t_obj):                 if self == t_obj:                         return True, ‘dupe ticket’                 if not isinstance (t_obj, Ticket):                         return False, ‘Object not type Ticket’                 return (str(self.serialNumber) == str(t_obj.serialNumber) and                         str(self.event) == str(t_obj.event), ‘comparison done’ )# global code ———————————————-t1 = Ticket (‘K. Ball’, ‘GMU Basketball’)t2 = Ticket (‘Tom Brady’, ‘Pats Game’)t3 = Ticket (‘Gene Shuman’, ‘Nats Game’)t4 = Ticket (‘E. Musk’, ‘SpaceX Launch’)t5 = Ticket (‘K. Ball’, ‘GMU Basketball’)t6 = Ticket (‘A. Trebek’, ‘Jeopardy Audience’)What is the display output of t1.equalTick (t5) ?

Read Details

Which of the following are valid reasons for creating getter…

Which of the following are valid reasons for creating getter or setter methods for a class called “Date”?  Check all that are valid reasons.

Read Details

Read the following code then check all the statements that a…

Read the following code then check all the statements that are true concerning the code. class Date ( ):         def __init__ (self, month, day, year):                 self.__month = month                 self.__day = day                 self.__year = year Assume code that uses the above class has created a Date object and assigned it variable id d1.  

Read Details

Assume that we have defined a class called House that has at…

Assume that we have defined a class called House that has attributes of owner’s name, address, number of bedrooms, and number of baths. The attribute names in the class definition are name, address, numBRs and numBAs. numBRs and numBAs are integers. The other attributes are strings (characters). What code will create a House object with owner name of “Mary Smith”, address of “6 Stable Way”, numBRs of 4, and numBAs of 2?  The object will be assigned the variable name h1.  

Read Details

Posts pagination

Newer posts 1 … 37,235 37,236 37,237 37,238 37,239 … 90,843 Older posts

GradePack

  • Privacy Policy
  • Terms of Service
Top