How can i make a list and slice it whenever a 27 or 28 appear and when its a 27 all the number after it would go to the top and any number before 28 would go bottom. And previously I only have a few function which involves swapping it but i'm not sure if it would help for this function.
>>> list = [1,2,3,28,4,5,6,27,7,8,9]
>>> list = [7,8,9,28, 4,5,6,27,1,2,3]
def triple_cut(cards):
if 27 and 28 in cards:
return cards[(index(27)):end] + cards[(index(28)):(index(27))] + cards[:(index(28))]
The logic should be like this but i cant do index for some reason can anyone help fix my code so it would work
Aucun commentaire:
Enregistrer un commentaire