1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
coldgirl [10]
4 years ago
15

There is a simple method for constructing a magic square for any odd value of n:

Computers and Technology
1 answer:
DaniilM [7]4 years ago
3 0

Answer:

See Explaination

Explanation:

class MagicSquare():

def __init__(self,side):

self.side=side

self.two_dimension=[]

for row in range(1,side+1):

row_line=[]

for col in range(1,side+1):

row_line.append(0)

self.two_dimension.append(row_line)

def display(self):

row=0

col=int((self.side-1)/2)

for i in range(1,self.side**2+1):

self.two_dimension[row][col]=i

row-=1

col+=1

if row==-1:

row=self.side-1

if col==self.side:

col=0

if self.two_dimension[row][col]==0:

continue

else:

row+=1

if row==self.side:

row==0

for line in self.two_dimension:

for num in line:

print("{0:>3}".format(num),end=" ")

print()

def main():

for i in range(1,14,2):

square=MagicSquare(i)

square.display()

print("----------------------------------------------------")

if __name__ == '__main__':

main()

You might be interested in
Image-editing software is used to _____.
bulgar [2K]

Answer:

B)enhance a photograph

3 0
3 years ago
Read 2 more answers
You are the IT security administrator for a small corporate network. The HR director is concerned that an employee is doing some
sp2606 [1]

Answer: A, it's the most professional way or C but I'd choose A

7 0
2 years ago
Which statement best explains taxation without representation was a major issue for colonists?
Sauron [17]
Taxation without representation was a major issue for the colonists, because they were being unfairly taxed by the British without having a representative in the British Parliament to represent them ans state that they were against this. It was also one of the driving forces of the American Revolution, as it was just one of the grievances the colonists were experiencing from the British. 
4 0
3 years ago
Since the password includes all four types of characters (complex password) and is 8 characters long, what is the real reason th
Liono4ka [1.6K]
It makes the possibility of an unwanted user to break into your account much smaller.
8 0
3 years ago
. How to insert Section Break in Microsoft word 2016 ?
aivan3 [116]

Answer:

C. Layout Tab – Page setup group – Breaks – Next page button.

3 0
4 years ago
Other questions:
  • A computer is defined by 4 specific criteri. Select all 4.*
    7·1 answer
  • Write a program that asks the user to enter a whole number then outputs a 0 if the number is even or a 1 if the number is odd. (
    14·1 answer
  • Individuals who require better speed and performance for graphics-intensive applications (e.g., video editing, gaming, etc.) pre
    8·1 answer
  • A(n) __ is a list of main points and sub-points of a topic to include in a presentation
    14·2 answers
  • You might have trouble interpreting a message if:
    15·1 answer
  • "What technology will examine the current state of a network device before allowing it can to connect to the network and force a
    6·1 answer
  • What is a characteristic of maintaining logs in a system? A. Logging prevents security violations, but only deals with passive m
    10·1 answer
  • A<br>A<br>printount<br>of your report or a till slip is an<br>example of what​
    15·1 answer
  • Я люблю есть гнезда петух
    11·1 answer
  • What maintains data about various types of objects, events, people, and places?
    10·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!