I want to make a list from other list:

   list1={A,B,C,S}; list2=Table[i,{i,1,end}];

Then my list three will be i->jwhere i are elements of list2 and j the elements of list 1 (repeated until end )


Assuming that the lists can be of unequal Length, Length[list1] >= Length[list2], and list2 cycles as required

list1 = {"A", "B", "C", "S"};

list2 = Range[3];

Thread[list1 -> PadRight[list2, Length[list1], list2]]

(* {"A" -> 1, "B" -> 2, "C" -> 3, "S" -> 1} *)
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.