task3 #2

Merged
schmidmarco merged 40 commits from task3 into main 2026-03-13 10:11:18 +01:00
Showing only changes of commit 00a42ea0fd - Show all commits

View File

@ -30,18 +30,20 @@ class PaginationHelper:
return len(
self.collection[
self.items_per_page * page_index : self.items_per_page * page_index * 2
self.items_per_page * page_index : self.items_per_page * page_index
+ self.items_per_page
]
)
# determines what page an item at the given index is on. Zero based indexes.
# this method should return -1 for item_index values that are out of range
def page_index(self, item_index):
pass
try:
self.collection[item_index]
if item_index < 0:
raise IndexError
except IndexError:
return -1
collection = ["a", "b", "c", "d", "e", "f"]
helper = PaginationHelper(collection, 4)
print(helper.page_count())
print(helper.page_item_count(1))
return item_index // self.items_per_page