Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def index(self, x):
- '''
- Returns the first index i in the linked list, where the value x is found. Returns None if none of the Cells
- has a value of x.
- The first element in the linked list has the index 0.
- '''
- def indx(cell, n):
- if cell.value == x:
- return n
- elif cell.is_empty:
- return None
- else:
- return indx(cell.tail, n + 1)
- return indx(self, 0)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement