Not really sure where this fits. Let's say I have a list:
>>>a = [1, 2, 3, 4, 5, 6, 7]
How can I repeat it so that it first checks 4, then 5, then 3, then 6, then 2 (and so on for large lists)? I could only work out a middle that
>>>middle = [len(a)/2 if len(a) % 2 = 0 else ((len(a)+1)/2)]
I'm really not sure how to apply this, and I'm not sure that my way of developing the middle is the best way. I thought about capturing two indexes after each iteration, adding 1 and subtracting 1 from each corresponding index, but I have no idea how to get the for loop to follow these rules.
As for why I need it; he is to analyze the actual game in the card game and will check from the middle card of this hand to each end until a valid card is played.
source
share