Reputation: 1
from itertools import chain, zip_longest
number_of_cards = int(input())
indexes = [3,3,2]
deck = [i for i in range(1, number_of_cards + 1)]
def func(lst, index):
shuffle1 = lst[:index]
shuffle2 = lst[index:]
res = []
for val in list(chain(*zip_longest(shuffle1,shuffle2))):
if val != None:
res.append(val)
return res
a = func(deck, 0)
b = func(a,1)
c = func(b,2)
d = func(c,3)
print(d)
I would like the use the same function but not hardcoded as I made it. Basically I want to mimic the last 5 rows in a new function. Please Help
Upvotes: 0
Views: 27