Linked Questions

Popular Questions

The code is running but there is not output showing

Asked by At

The code is being executed but the output is not shown nor the variables are created

import numpy as np
def magicsquares():
    n=input('enter the order of squares')
    n=int(n)
    m=np.zeros((n,n))
    s=n*(n**2+1)/2 #sum of each row or diagonal
    p=int(n/2)
    q=(n-1)
    for i in range(n**2):
        m[p][q]=1       #assigning postion of 1
        P=p-1
        Q=q+1
        if(i>=2):       #assigning remaining positions
            if(P==-1):
                P=n-1
            if(Q==n):
                Q=0

Related Questions