Toggle Navigation
Hatchery
Eggs
Mod Music Player
rotated_list.py
Users
Badges
Login
Register
MCH2022 badge?
go to mch2022.badge.team
rotated_list.py
raw
Content
def forward(rotated_list, current_value): # not using valueerror exception handling here: the data in the app should be correct. current_index = rotated_list.index(current_value) if current_index == len(rotated_list) - 1: return rotated_list[0] else: return rotated_list[current_index + 1] def backward(rotated_list, current_value): current_index = rotated_list.index(current_value) if current_index == 0: return rotated_list[len(rotated_list) - 1] else: return rotated_list[current_index - 1]