See code below, type the same as written in Book Data Structur and Algorthm in Python, I am new to programming, can someone help?
from abc import ABCMeta, abstractmethod
class Sequence(metaclass=ABCMeta):
@abstractmethod
def __len__(self):
@abstractmethod
def __getitem__(self, j): **# Here there is red wave line under 'def'**
def __contains__(self, val):
for j in range(len(self)):
if self[j] == val:
return True
return False
def index(self, val):
for j in range(len(self)):
if self[j] == val:
return j
raise ValueError('value not in sequence')
def count(self, val):
k = 0
for j in range(len(self)):
if self[j] == val:
k += 1
return k