Skip to content

Commit

Permalink
Fix count bug #1
Browse files Browse the repository at this point in the history
  • Loading branch information
BaseMax authored Dec 6, 2022
1 parent 1ccf7a7 commit f342c82
Showing 1 changed file with 2 additions and 0 deletions.
2 changes: 2 additions & 0 deletions ArrayList.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ def add_at(self, index, item):
if index < 0 or index >= self.size:
raise Exception("Index out of range")
self.items.insert(index, item)
self.count += 1

def add_first(self, item):
self.add_at(0, item)
Expand All @@ -38,6 +39,7 @@ def remove_at(self, index):
if index < 0 or index >= self.size:
raise Exception("Index out of range")
del self.items[index]
self.count -= 1

def remove_first(self):
self.remove_at(0)
Expand Down

0 comments on commit f342c82

Please sign in to comment.