3) Implement the following class. class EqualityTest: Contains the methods below. def _init__(self, some_lst, some_str):

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

3) Implement the following class. class EqualityTest: Contains the methods below. def _init__(self, some_lst, some_str):

Post by answerhappygod »

3 Implement The Following Class Class Equalitytest Contains The Methods Below Def Init Self Some Lst Some Str 1
3 Implement The Following Class Class Equalitytest Contains The Methods Below Def Init Self Some Lst Some Str 1 (65.92 KiB) Viewed 38 times
3) Implement the following class. class EqualityTest: Contains the methods below. def _init__(self, some_lst, some_str): This is EqualityTest constructor. Both parameters must be stored to instance variables of the same names (some_1st, some_str). o some_lst : a list. o some_str : a str. • def equal_str (self, s): Takes in a str and Returns a bool. The method returns True if the string s equals the instance variable some_str, otherwise it returns False. def equal_lst (self, lst): Takes in a list and Returns a bool. The method returns True if the list 1st equals the instance variable some_1st, otherwise it returns False. Example run: e = EqualityTest([1, 2, 3], "hello") print(e. some_1st) [1, 2, 3] print(e. some_str) hello print(e.equal_lst([1, 2, 3])) True print(e.equal_lst([1, 2, 3, 4])) - False print(e.equal_str("hello")) True print(e.equal_str("hell")) False
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply