Sorry for the confusing question. I have a list called switch that contains randomly chosen numbers between 10 and 30. I am trying to use these numbers in the following function (this is just the start):
def rewardfunc(y, switch): left_reward = [] right_reward = [] for x in range(switch[0]): left_reward.append(prob(y)) right_reward.append(prob(1-y)) for x in range(switch[1]): left_reward.append(prob(1-y)) right_reward.append(prob(y)) for x in range(switch[2]): left_reward.append(prob(y)) right_reward.append(prob(1-y)) for x in range(switch[3]): left_reward.append(prob(1-y)) right_reward.append(prob(y)) In this function, every number in switch is used to define a block of trials, but every other number defines a different kind block. So, my problem is how do I use every number in switch in order, while using every other number for a different task? Currently, I'm writing it out as for x in range((switch[0]))... is there a way to do this in a shorter form?
Hope my question makes sense. Thank you for any help.