Question: class Violet: def __init__(self, w): self.w = w self.j = '' self.B = 0 def carrot(self): try: return int(self.j) except: return self.j def kale(self): v

 class Violet: def __init__(self, w): self.w = w self.j = ''

class Violet: def __init__(self, w): self.w = w self.j = '' self.B = 0 def carrot(self): try: return int(self.j) except: return self.j def kale(self): v = str(self.w*self.w) q = int(v[len(v)//2-3:len(v)//2+3]) b = int(q/999999 * 100) self.w = q self.j += str(b) self.B += 1 return b def tomato(self): return self.j def green(self): v = str(self.w*self.w) q = int(v[len(v)//2-3:len(v)//2+3]) b = int(q/999999 * 26) + 65 self.w = q self.j += chr(b) self.B += 1 return b def strawberry(self, v): q = str(v)[0] b = (self.next()//10) * q + v return b def sardine(self): return self.B

Copy the class in the box below into your Python editor and write a program that performs the following operations in the order that you see below. Note that your program SHOULD NOT modify the class in any way. Simply write a main program that does the following: 1. Create 2 objects of type Violet. Each object should be initialized with a different constructor argument. The 1st object should be initialized with a constructor argument of 206097 (integer). The 2nd object should be initialized with a constructor argument of 931045 (integer). 2. Have the 1st object call its 'kale' method 5 times 3. Have the 2 nd object call its 'green' method 7 times 4. Have the 1st object call its 'carrot' method and store the result. 5. Have the 2nd object call its 'carrot' method and store the result. 6. Add all results returned by the 'carrot' method that are of an integer data type and enter them into the blank below

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!