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
In Python please:
Sauron [17]

Answer:

import math

angle = float(input('Enter Angle: '))

shadowLength = float5(input('Enter Shadow Length: '))

tree_height = math.tan(angle)*shadowLength

print('Tree Height = {}'.format(tree_height))

Explanation:

From the equation given, the first step is to derive the equation for calculating the Tree Height.

tan(angleElevation) = tree height / shadow length\\\\tree height = tan(angleElevation) * shadow length

In order to calculate the tangent of an angle, the math module has to be imported. math module allows the program to perform advanced math operations.

The program then prompts the user to input values for angle and shadow length.

The inputted values are converted to floats and used in the equation that was derived for Tree height.

Three height is evaluated and the result is printed to the screen

4 0
3 years ago
How it print media used? ​
ivann1987 [24]
Newspapers are one of them
5 0
3 years ago
Based on the details in The Riddle of the Rosetta Stone, how did the career of Jean-Baptiste Fourier differ from that of Jacques
maksim [4K]

Answer:

D

Explanation:

5 0
3 years ago
Read 2 more answers
The Institute of Electrical and Electronics Engineers (IEEE) is an organization that researches and institutes electrical standa
Evgesh-ka [11]

Answer:

True

Explanation:

The Institute of Electrical and Electronics Engineers (IEEE) is an organization that researches and institutes electrical standards for communication and other technologies. Known officially as IEEE 802.11n (or wireless-N) is the newest standard for wireless networking. Compared with earlier standards like 802.11b, wireless-N offers faster speeds, more flexibility, and greater range.

6 0
3 years ago
Read 2 more answers
What new england industry quickly collapsed with the discovery of oil in pennsylvania
Elena-2011 [213]

It was the whaling industry.  Whaling use to be the main source of oil that was used for fuel and lighting in America which was based in the coastal communities of New England.  It went into decline when oil was discovered in 1859.  Eventually it replaced whale oil as a source of fuel and life.

6 0
3 years ago
Read 2 more answers
Other questions:
  • Which of the following parameters should match in order for a pair of routers to form an adjacency when running OSPFv2? (Points
    9·1 answer
  • Is social media and advancement of technology causing our society to become less social?
    13·1 answer
  • The feedforward part of the conversation should do all of the following except __________.a.identify the toneb.introduce the pur
    11·1 answer
  • Where is line-of-sight Internet common?<br> In space<br> Outdoors<br> Inside<br> In businesses
    10·1 answer
  • Hi weegy, what is the latest android os?
    9·1 answer
  • What is the result when you run the following program?<br> print("2 + 7')<br> print(3 + 1)
    6·2 answers
  • Dave has to create animations for a game. Which tool can Dave use?
    6·1 answer
  • Which tool is used to plan a web site?<br> HTML<br> Storyboard<br> Text editor<br> WYSIWYG
    5·2 answers
  • Which of the following are NOT possible using the RANDOM(a, b) and DISPLAY(expression) abstractions?
    10·1 answer
  • As part of your regular system maintenance, you install the latest operating system updates on your Windows 10 computer. After s
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!