# How do you iterating over different slices and assigning each slice a unique value from the other slice

I need help in performing some tasks in that

users := []string{“K1”, “K2”, “K3”, “K4”, “K5”, “K6”, “K7”, “K8”, “K9”, “K10”, “K11”, “K12”, “K13”}
nos := []int{0, 1, 2, 3, 4, 5, 6, 7, 8, 9}
pin_alphabets := ////contains all the alphabets i.e A-Z

I need to assign each user with 1 nos. and in each user+nos, assign a set of alphabets.
each pin no should have alphabets A-Z.

eg K1 = 0A, 0B, 0C, 0D etc
K2 = 1A, 1B, 1C, 1D etc

putting in mind that since users are more than nos, the nos that are repeated should also have unique alphabets and should not share same alphabets with users with same nos as them

eg K11 =0?, 0? etc
K12 =1?, 1? etc

I don’t understand. By “alphabets,” do you mean the 26 letters (A-Z) of the basic Latin alphabet or do you mean actual alphabets (e.g. Latin, Greek, Cyrillic, etc.)?

If the former, and you want sequences like

K1 = 0A, 0B, …, 0Z
K2 = 1A, 1B, …, 1Z

K12 = 12A, 12B, … 12Z

Then this will do it: https://play.golang.org/p/RVnbDzQ4r_x
If you meant the latter or something else, then I need more info.

Thanks for the feedback. after a long time of trying to understand how slices work in go, that is what i managed to come up with

https://play.golang.org/p/iwXl2n-gIob

That’s what I managed to come up with.
Now how do I make sure that the second last slice value joins the other large values on top for readability and easy understanding of how the chunked slices follow each other??

And on line 23, I would like to understand why I have to declare slice1[chunkHangingColums:] independently and then append it into chunk1

slice1, chunk1 = slice1[chunkHangingColums:], append(chunk1, slice1[0:chunkHangingColums:chunkHangingColums])

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.