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
Can some give me engineers names that start with the letter A-Z
Nadya [2.5K]

Answer:

elon musk/ bill gates/ jeff bezos/ henry ford/ tim cook

Explanation:

i googled it/ i added more

6 0
3 years ago
Does anybody play nitro type
vlabodo [156]

Answer: Nah

Explanation: it kinda sucks and is a waste of time, play better games lol

3 0
3 years ago
Read 2 more answers
What are the main differences between photo and video formats?
horrorfan [7]

Answer:

Nothing just the video is series of photos together

Explanation:

8 0
3 years ago
The type of database that is most capable of supporting complex data types is _____. Select one: a. sequential files b. relation
Anestetic [448]

Answer:

Object-Oriented DBMS.

Explanation:

Like classes in Object oriented programming Object-Oriented DBMS is can store objects.It follows an Object oriented data model with the properties of classes and the properties of Object oriented programming also.Objects can be in the form of complex data types or different data types.

6 0
3 years ago
Read 2 more answers
_____ are Internet-based companies specializing in securing the electronic transfer of funds.
ira [324]
I am not exactly sure but I believe it would be Cybermediaries, They act as a third party for the transfer of funds. examples being online insurance and real estate brokers. 
7 0
3 years ago
Other questions:
  • How to select the entire table in microsoft excel
    11·1 answer
  • How can a user view the options for Junk E-mail?
    11·2 answers
  • I need help!!!!
    13·2 answers
  • Which windows system include new features and extends the functionality
    13·1 answer
  • HELP 99PTS If Answered
    12·2 answers
  • If your computer won't connect to the internet, which of these is most likely to be the problem?
    8·1 answer
  • The function of the __________ is to on transmission assemble data into a frame, on reception disassemble frame and perform addr
    8·1 answer
  • What would be an ideal scenario for using edge computing solutions?
    10·1 answer
  • Write a program to sort the (name, age, score) tuples by descending order where name is string, age and score are numbers. The s
    6·1 answer
  • Microsoft PowerPoint is an example of a(n) _____ application.
    15·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!