What is printed by the following? def grade (score): if score > 90: return ‘A’ elif score > 80: return ‘B’ elif score > 70: return ‘C’ elif score > 60: return ‘D’ else: return ‘F’ print(grade(78))
How can you obtain the string ‘IT’ from s = ‘IT 209’?
How can you obtain the string ‘IT’ from s = ‘IT 209’?
Which of the following are read methods in Python? (check al…
Which of the following are read methods in Python? (check all that apply):
How many times will the word ‘PYTHON’ be printed? word =…
How many times will the word ‘PYTHON’ be printed? word = ‘PYTHON’ for n in range(3): print(word)
What can be added to the following code to cause the year to…
What can be added to the following code to cause the year to be displayed when the code is executed? class Date(): def __init__(self, month, day, year, descr = ‘Today’): self.__month = str(month) self.__day = str(day) self.__year = str(year) self.__descr = descr def getYear (self): return self.__year def setYear (self, year): self.__year = year return True # return ‘True’ to indicate success def __str__(self): return(str(self.__month) + ‘/’ + str(self.__day) + ‘/’ + str(self.__year) + ‘ – ‘ + str(self.__descr)) d1 = Date(’10’, ’01’, ‘2023’)d1.setYear(‘2024’)# We want to display the year …
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 = 10 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 print (Ticket.ticketCount) ?
Which one of the following constitutes a proper email subjec…
Which one of the following constitutes a proper email subject header for an email sent to the professor?
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) ?
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): def __init__ (self, name, event, serialNo): self.cust_name = name self.event = event self.serialNumber = serialNo def __str__ (self): return (‘Ticket for ‘ + self.cust_name + ‘ – ‘ + self.event) # global code ———————————————-t1 = Ticket (‘Molly Smith’, ‘Concert’, ‘a250’)t2 = Ticket (‘Tom Brady’, ‘Bucs Game’, ‘NFL0100’)t3 = Ticket (‘Mike Rizzo’, ‘Nats Game’, ‘WS2023’)t4 = Ticket (‘E. Musk’, ‘SpaceX Launch’,’NASA2021′)t5 = Ticket (‘K. Ball’, ‘GMU Basketball’,’Pats11293′)t6 = Ticket (‘A. Trebek’, ‘Jeopardy Audience’,’Historyfor1000′)t2.event = t5.eventt6.event = t2.eventWhat is the display output of print (t6) ?
View the following class definition, then answer the questio…
View the following class definition, then answer the question that follows. class Date ( ): 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 should be done to the above code so that its objects include a year as an attribute? Check all that must be done.