How to loop through 3 different arrays by using a single for loop in Python
<p>I have 3 different arrays:</p>

<pre><code>a = (x, y, z)
b = (p, q)
c = (r, s)
</code></pre>

<p>I need to loop through all this arrays. Presently I am using the below method:</p>

<pre><code>for loop_a in a:
  loop_a = some_value

for loop_b in b:
  loop_b = some_value

for loop_c in c:
  loop_c = some_value
</code></pre>

<p>How I can do this using a single for loop and iterate through all the arrays. Functionality inside the loop is same for all. I need an efficient way to do this. I checked many other already answered questions, but couldn't find a fitting answer.</p>

<pre><code>def t():
    a = [1, 2, 3]
    b = [4, 5]
    c = [6, 7]
    l1 = [a, b, c]
    someValue = "This should print 4 times"
    for i in l1:
      l1[0] = someValue
      l1[1] = someValue
      l1[2] = someValue

    print(someValue)
    print(l1[0])
    print(l1[1])
    print(l1[2])
t();
</code></pre>

<p>I put the lists in a list and took the index of the new list.</p>

python arrays for-loop