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]
2 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]2 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
Which of these are examples of a Single Sign-On (SSO) service?
12345 [234]
Kerberos and OpenID are SSO Services.
5 0
3 years ago
Fact Pattern: A sales transaction record designed to contain the information presented below. Column Information 1-10 Customer a
ozzi

Answer:

The answer is field check.

Explanation:

The sales transaction record was designed to enter information by range, so the data validation is oriented for range validation and not for a specific logic. In other words, the transaction will check if the information is in a valid range and not if the information is logically valid.

4 0
2 years ago
So, I have an Cru__ on this boy in school and his name is Bray but Yeah.............Can someone help me
tester [92]

Explanation:

Okay so, am not a great person at that but my best advice would be. to be yourself. you can always be honest and talk to him privately that you have a crush on him. Dont be afraid and if he doesn't go to well dont feel bad, at least you had the guts to tell him. other girls would be scared.

4 0
3 years ago
Read 2 more answers
15. Feelings (maps, coins, clues, etc.) and the invisClue books were some innovative ways used to keep __________ players engage
Anit [1.1K]

Answer:

pong i could be wrong i think its right tho

Explanation:

5 0
2 years ago
Read 2 more answers
Dynamic disk storage provides the flexibility to logically organize disk space across one or more disk drives.
zhuklara [117]
<span>Dynamic disk storage provides the flexibility to logically organize disk space across one or more disk drives. 
a. True 
b. False</span>
3 0
3 years ago
Other questions:
  • Write a program that calls fork(). Before calling fork(), have the main process access a variable (e.g., x) and set its value to
    5·1 answer
  • What’s the answer?............................
    13·1 answer
  • What is called photo and video edition?
    8·1 answer
  • You wish to lift a 12,000 lb stone by a vertical distance of 15 ft. Unfortunately, you can only generate a maximum pushing force
    6·1 answer
  • "Once a business operations analysis is completed and change needs to
    7·2 answers
  • A group of computers that are interconnected in order to share information or documents is called a _____.
    7·1 answer
  • . What is the relationship between frequency, wavelength and speed of a wave?
    15·1 answer
  • What is the output of the C++ codeabove?
    14·1 answer
  • In an array-based implementation of a dictionary, if you represent the entries as an array of objects that encapsulate each sear
    12·1 answer
  • What is NOT a built-in function in python?<br> sqrt()<br> string()<br> fabs()<br> O print()
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!