Input to a three dimensional array in python
<p>I'm new at coding in python and I was wondering if there is some way I can transcript this code in C to python:</p>

<pre><code>for (K=1; K&lt;3; K++)
    for (I=0; I&lt;3; I++)
        for (J=0; J&lt;7; J++){
            printf("Year: %d\tProvince: %d\tMonth: %d: ", K, I, J);
            scanf("%f", &amp;A[I][J][K]);
        }
</code></pre>

<p>This is all I have done so far, the only thing missing is how to input data in the three dimensional array</p>

<pre><code>for k in range(1,3):
    for i in range(1,3):
        for j in range(1,7):
            print("Year: " + str(k) + " Province: " + str(i) + " Month: " + str(j) + ": ")
</code></pre>

<p>If you want to do that in just standard, native python this should work:</p>

<pre><code>import pprint # To display "3d array" in a recognizable format 
A = [[[0 for _ in range(2)] for _ in range(2)] for _ in range(6)]

for k in range(2):
    for i in range(2):
        for j in range(6):
            print("Year: {0} Province: {1} Month: {2}".format(k,i,j))
            A[j][i][k] = raw_input()

pprint.pprint(A) # for an easy to read 2x2x6 format display
</code></pre>

<p>After inputting some numbers (eg. 1-24), gives output:   </p>

<pre><code>[[['1', '13'], ['7', '19']],  
[['2', '14'], ['8', '20']],  
[['3', '15'], ['9', '21']],  
[['4', '16'], ['10', '22']],  
[['5', '17'], ['11', '23']],  
[['6', '18'], ['12', '24']]]  
</code></pre>

python c arrays input