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
What is the typical educational requirement for a non-entry level software programmer?
Slav-nsk [51]
Certificate or associate's degree with considerable work experience; bachelor's degree most often required; master's degree for some jobs
7 0
3 years ago
Read 2 more answers
The area of the spreadsheet highlighted in red is the _____.
iragen [17]

A spreadsheet is a software application which is used to display numerical data in a tabular form. It has <em>further functions</em> which includes organizing, displaying, calculating data, etc where the data can be viewed at a glance and retrieved from memory.

There are <em>different types</em> of spreadsheet which includes:

  • <u>G00gle Sheet</u>
  • <u>Microsoft Excel</u>
  • <u>LibreOffice</u>
  • <u>Smartsheet,</u> etc.

Data can be arranged in rows and columns.

Please note that your question is incomplete so I gave you a general overview to help you get a better understanding of the concept.

Read more here:

brainly.com/question/22101774

5 0
2 years ago
Please answer this question correctly​
jeka94

Im only in 4th sorry i dont think i can help

5 0
2 years ago
School computer labs are used often to teach technology skills or subject-specific skills ____ the rest of the curriculum.
Lyrx [107]
The answer that best fits the blank is ISOLATED FROM. Those technology skills and subject-specific skills that are separated from the rest of the curriculum are being taught using the school computer laboratories. Technology skills include skills that use computers or machines such as web design, email management, database and spreadsheets, and etc.
8 0
3 years ago
Algorithm and flowchart:- find the product of two number (a and b)​
Korvikt [17]

Answer:

i have no idea a i guess

Explanation:

5 0
3 years ago
Other questions:
  • The title of a Web page is the text that appears on the title bar and taskbar of the browser window. *
    13·1 answer
  • In modern computer memory, each location is normally composed of one byte.
    7·1 answer
  • Brute force attacks involve identifying a valid user account and then bombarding the server with an extensive:
    13·1 answer
  • Write a MARIE program to allow the user to input 8 integers (positive, negative, or zero) and then find the smallest and the lar
    15·1 answer
  • A professor is working with five teams in his marketing research class. He decides to experiment with path-goal theory in helpin
    11·1 answer
  • What is your favorite food
    11·2 answers
  • Me inculparon de crear una cuenta en Facebook y colocaron el barrio donde vivo, ¿cómo podría demostrar lo contrario? Ayuda urgen
    6·1 answer
  • Why when you are on wifi it keeps kicking you off is your class during online learning​
    15·2 answers
  • Which of the following is a particularly useful feature of Microsoft PowerPoint and
    8·2 answers
  • Which is NOT true?<br> 9 + 4 = 17 - 4<br> 8 + 7 = 14 + 3<br> 11 = 19 - 8<br> 5 + 8 = 20 - 7
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!