Given the following custom class myClass,which of the following statements are TRUE? Select all that apply. class myClass: def _init__(self, code, name): self.code = code self.name = name self.roster def enrol(self, 1st: list[str]) -> None: Add each element of to the roster once. for item in 1st: if item not in self.roster: self.roster.append(lst) n The attribute roster cannot be defined, since it's not a parameter of the initializer. n The method enrol is correct. n The method enrol is incorrect because it doesn't properly add elements to the roster. n The method enrol is incorrect because it doesn't properly ignore duplicate string elements. n The method enrol is incorrect because it doesn't return anything. The initializer is incorrect as it creates more attributes than are passed. The command print(c.roster) prints the list roster, where c is an instance of myClass. The command print(c.roster) prints a memory address, as _repr_ or _str_ aren't defined. --
Given the following custom class myClass,which of the following statements are TRUE? Select all that apply. class myClass: def _init__(self, code, name): self.code = code self.name = name self.roster def enrol(self, 1st: list[str]) -> None: Add each element of to the roster once. for item in 1st: if item not in self.roster: self.roster.append(lst) n The attribute roster cannot be defined, since it's not a parameter of the initializer. n The method enrol is correct. n The method enrol is incorrect because it doesn't properly add elements to the roster. n The method enrol is incorrect because it doesn't properly ignore duplicate string elements. n The method enrol is incorrect because it doesn't return anything. The initializer is incorrect as it creates more attributes than are passed. The command print(c.roster) prints the list roster, where c is an instance of myClass. The command print(c.roster) prints a memory address, as _repr_ or _str_ aren't defined. --
Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
Related questions
Question
![Given the following custom class myClass ,which of the following statements are TRUE? Select all that apply.
class myClass:
def _init__(self, code, name):
self.code = code
self.name = name
self.roster = 0
def enrol(self, 1st: list[str]) -> None:
""" Add each element of <īst> to the roster once.
I" II II
for item in lst:
if item not in self.roster:
self.roster.append(lst)
n The attribute roster cannot be defined, since it's not a parameter of the initializer.
The method enrol is correct.
n The method enrol is incorrect because it doesn't properly add elements to the roster.
The method enrol is incorrect because it doesn't properly ignore duplicate string elements.
The method enrol is incorrect because it doesn't return anything.
The initializer is incorrect as it creates more attributes than are passed.
n The command print(c.roster) prints the list roster, where c is an instance of myClass.
n The command print(c.roster) prints a memory address, as _repr__ or __str__ aren't defined.
---](/v2/_next/image?url=https%3A%2F%2Fcontent.bartleby.com%2Fqna-images%2Fquestion%2Fbaf174e5-b22e-49e3-bb13-33053eb86002%2F32e2b6bf-407c-4c1e-bf26-84e82afa870d%2F1b6dttk_processed.png&w=3840&q=75)
Transcribed Image Text:Given the following custom class myClass ,which of the following statements are TRUE? Select all that apply.
class myClass:
def _init__(self, code, name):
self.code = code
self.name = name
self.roster = 0
def enrol(self, 1st: list[str]) -> None:
""" Add each element of <īst> to the roster once.
I" II II
for item in lst:
if item not in self.roster:
self.roster.append(lst)
n The attribute roster cannot be defined, since it's not a parameter of the initializer.
The method enrol is correct.
n The method enrol is incorrect because it doesn't properly add elements to the roster.
The method enrol is incorrect because it doesn't properly ignore duplicate string elements.
The method enrol is incorrect because it doesn't return anything.
The initializer is incorrect as it creates more attributes than are passed.
n The command print(c.roster) prints the list roster, where c is an instance of myClass.
n The command print(c.roster) prints a memory address, as _repr__ or __str__ aren't defined.
---
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
Step by step
Solved in 2 steps

Recommended textbooks for you

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON

Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science

Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning

Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning

Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education

Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY