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
How do you fix The lag on your zsnes emulator
GenaCL600 [577]
Try resetting the phone if that doesn’t work do a hard reset
7 0
3 years ago
Where can a user find out more information about a hardware or network failure that occurred on that particular pc?
dolphi86 [110]
In *nix the logs are usually in /var/log . They're usually restricted to privelidged access. In Windows, the Event Logs
7 0
3 years ago
Traditional methods of collecting systems requirements include: a. rapid application development. b. prototyping. c. interviews.
diamong [38]

Answer:

interviews

Explanation:

because the designer gets to directly interact with the customer who knows exactly what they want.

3 0
1 year ago
The motion of electrons can be predicted precisely.<br><br> True<br> False
Aleksandr-060686 [28]
The statement above is false; the motion of electrons can not be predicted precisely. Electrons move around the orbit shells at different energy levels in atoms. Previous research works had devised ways of measuring the angular velocity of electrons and means of tracking the movement of electrons in atoms but the movement of these electrons can not be predicted. They move in a random manner round the nucleus of an atom.<span />
6 0
3 years ago
Read 2 more answers
Which of the following are the two main types of copyright relevant to the recording industry? Select all that apply
Bond [772]

Answer:

LETTER A...

CUZ ITS TRUE

6 0
2 years ago
Other questions:
  • These commands are established by combatant commanders when authorized by the Secretary of Defense through the Chairman of the J
    5·1 answer
  • Tanya has received an email, apparently from her bank, stating that some of her records were lost during server maintenance work
    13·2 answers
  • What is the most widely used operating system for mobile devices?
    7·1 answer
  • Plz help! 3 questions! 1.The ideal light to use is.... A.front light B.a combination of side and back light C.a combination of f
    10·1 answer
  • This process can be applied to help workers choose the best telecommunications technology to do a specific task.
    6·2 answers
  • To communicate with coworkers in the office
    10·1 answer
  • Suppose that we are using PDDL to describe facts and actions in a certain world called JUNGLE. In the JUNGLE world there are 4 p
    7·1 answer
  • A type of authentication that requires the user to provide something that they know, such
    6·1 answer
  • Helppppppppppppppp me please Can i have help for a ggogle class room
    5·1 answer
  • It refers to the story or events in which the film revolves.
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!