definit_(self, lin, st, sz): # Initializing Variables self.start = st self.size = sz self.cir = []*len (lin) This method will check the given array across the base array and if they are equivalent interms of values return true, or else return false''' def equivalent (self, cir_arr): # To Do pass # Remove this line print("= ======Test 7==========") lin_arr6 = [10, 20, -30, 20, 50, 30, None] c6 = CircularArray (lin_arr6, 2, 6) c7 = CircularArray (lin_arr6, 5, 6) c6.printForward() # This should print: 10, 20, -30, 20, 50, 30 c7.printForward() # This should print: 10, 20, -30, 20, 50, 30 print(c6.equivalent (c7)) # This should print: True

EBK JAVA PROGRAMMING
9th Edition
ISBN:9781337671385
Author:FARRELL
Publisher:FARRELL
Chapter8: Arrays
Section: Chapter Questions
Problem 10RQ
icon
Related questions
Question
Use python and do not use any library. Remove the pass line and complete the code after #todo section
class CircularArray:
def __init__(self, lin, st, sz):
Variables
# Initializing
self.start = st
self.size = sz
self.cir = []*len (lin)
"This method will check the given array across the base array
and if they are equivalent interms of
values return true, or else return false'''
def equivalent (self, cir_arr):
# To Do
pass # Remove this line
print("==========Test 7==========")
lin_arr6 = [10, 20, -30, 20, 50, 30, None]
c6 = CircularArray (lin_arr6, 2, 6)
c7 = CircularArray(lin_arr6, 5, 6)
c6.printForward()
# This should print: 10, 20, -30, 20, 50, 30
c7.printForward() # This should print: 10, 20, -30, 20, 50, 30
print(c6.equivalent (c7)) # This should print: True
print("= ======Test 8=
=")
lin_arr7 = [10, 20, -30, 20, 50, 30, None, None, None]
c8 = CircularArray (lin_arr7, 8, 6)
c6.printForward() # This should print: 10, 20, -30, 20, 50, 30
c8.printForward() # This should print: 10, 20, -30, 20, 50, 30
print(c6.equivalent (c8)) # This should print: True
print(": ======Test 9==========")
lin_arr8 = [10, 20, 30, 40, 50, 60, None, None, None]
c9 = CircularArray (lin_arr8, 8, 6)
c6.printForward() # This should print: 10, 20, -30, 20, 50, 30
c9.printForward() # This should print: 10, 20, 30, 40, 50, 60
print(c6.equivalent (c9)) # This should print: False
Transcribed Image Text:class CircularArray: def __init__(self, lin, st, sz): Variables # Initializing self.start = st self.size = sz self.cir = []*len (lin) "This method will check the given array across the base array and if they are equivalent interms of values return true, or else return false''' def equivalent (self, cir_arr): # To Do pass # Remove this line print("==========Test 7==========") lin_arr6 = [10, 20, -30, 20, 50, 30, None] c6 = CircularArray (lin_arr6, 2, 6) c7 = CircularArray(lin_arr6, 5, 6) c6.printForward() # This should print: 10, 20, -30, 20, 50, 30 c7.printForward() # This should print: 10, 20, -30, 20, 50, 30 print(c6.equivalent (c7)) # This should print: True print("= ======Test 8= =") lin_arr7 = [10, 20, -30, 20, 50, 30, None, None, None] c8 = CircularArray (lin_arr7, 8, 6) c6.printForward() # This should print: 10, 20, -30, 20, 50, 30 c8.printForward() # This should print: 10, 20, -30, 20, 50, 30 print(c6.equivalent (c8)) # This should print: True print(": ======Test 9==========") lin_arr8 = [10, 20, 30, 40, 50, 60, None, None, None] c9 = CircularArray (lin_arr8, 8, 6) c6.printForward() # This should print: 10, 20, -30, 20, 50, 30 c9.printForward() # This should print: 10, 20, 30, 40, 50, 60 print(c6.equivalent (c9)) # This should print: False
Expert Solution
steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
Microsoft Visual C#
Microsoft Visual C#
Computer Science
ISBN:
9781337102100
Author:
Joyce, Farrell.
Publisher:
Cengage Learning,