I'm trying to figure out how to print the following list while not starting by the first item. To be clear: If the list is [0,1,2,3,4,5,6,7,8]
, I want to print something like 4,5,6,7,8,0,1,2,3
Here's the code:
you_can_move_on = False
List = [0,1,2,3,4,5,6,7,8]
next_player = 3
while not you_can_move_on:
next_player = self.get_next_player_index(next_player)
you_can_move_on = self.check_if_I_can_move_on
print(next_player)
def get_next_player_index(self, i):
if i == len(self.players):
return 0
else:
return i+1
def check_if_I_can_move_on(self):
return False
I think it should be
print(l[3:] + l[:3])
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With