1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Artemon [7]
3 years ago
6

Write a class Example() such that it has a method that gives the difference between the size of strings when the '-' (subtractio

n) symbol is used between the two objects of the class. Additionally, implement a method that returns True if object 1 is greater than object 2 and False otherwise when the (>) (greater than) symbol is used. For example: obj1 = Example('this is a string') obj2 = Example('this is another one') print(obj1 > obj2) False print(obj1-obj2) 3
Computers and Technology
1 answer:
Mariulka [41]3 years ago
3 0

Answer:

class Example:

def __init__(self, val):

self.val = val

def __gt__(self, other):

return self.val > other.val

def __sub__(self,other):

return abs(len(self.val) - len(other.val))

def main():

obj1 = Example('this is a string')

obj2 = Example('this is another one')

print(obj1 > obj2)

print(obj1 - obj2)

main()

\color{red}\underline{Output:}

You might be interested in
Ftp is a _________ that is utilized to copy and manage files over the internet
Marizza181 [45]
<span>Ftp is a network protocol that is utilized to copy and manage files over the internet.  </span>FTP<span> is widely </span>used<span> for transferring </span>files<span> between computers </span>over<span> a TCP/IP-based network, such as the </span>Internet<span>.</span>
5 0
4 years ago
Joe has just started the Security Module. He wants to get through it as quickly as possible and take the Quiz. As he clicks thro
Scorpion4ik [409]

Answer:

Joe should read the explanatory text and complete the learning activities.

Explanation:

Given

See attachment for options

Required

Best strategy to get through the module

First off, rushing through the activities and taking guess for each question (as suggested by (a)) will not help him;

He may complete the activities but sure, he won't learn from the module.

Also, reading through the units without completing the activities is not an appropriate method because Joe will not be able to test his knowledge at the end of the module.

The best strategy to employ is to read through the units and complete the activities, afterwards (option (b)).

4 0
3 years ago
Which Operating System is used most often in households?
pshichka [43]

Answer:

Windows

Explanation:

Windows are one of the most popular household os.

3 0
3 years ago
Read 2 more answers
30% of the mass of an objects is 24 kilograms. use this fact to find:
Triss [41]

Answer:

chemați. mfvd5. fn. cfcfcfcfcfcfcf 4t

6 0
3 years ago
National Computer Corporation (NCC) employs Cynthia as an agent. NCC gives her an exclusive territory in which to sell NCC produ
LuckyWell [14K]

Answer:

The answer is cooperation

Explanation:

National Computer Corporation (NCC) employs Cynthia as an agent. NCC gives her an exclusive territory in which to sell NCC products. NCC cannot compete with her in that territory under the duty of cooperation

8 0
4 years ago
Other questions:
  • Select all of the uses of presentation software in the workplace.
    8·1 answer
  • List any 5 Unix commands with their brief description?
    9·1 answer
  • Jeremy is typing a term paper on his computer and saves it every five minutes or so for good measure. which of the following bes
    11·1 answer
  • ShellShock had the potential for an unauthorized user to gain access to a server. It affected many internet-facing services, whi
    11·1 answer
  • How does this app work?
    11·2 answers
  • The File method lastModified() returns
    10·1 answer
  • With Voice over Internet Protocol (VoIP), _____. a. voicemails cannot be received on the computer b. call quality is significant
    6·1 answer
  • In the textbox below, write an email that you, as an administrative assistant at Techno Inc., would write to request information
    7·1 answer
  • _KOH + _Cu(CIO3)2 - __KCIO3 +<br>_Cu(OH)2​
    12·1 answer
  • Explain the measures put in place in order to maintain each of the element of computer security<br>​
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!