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]
3 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]3 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
Maria's manager asked her to print a certain document for their meeting. It took her so long to find the file that she was late
Hoochie [10]

hey let me and sans help. . . . .hmmm. . .

sans said create a word-processing document that lists where she has saved files.

9 0
3 years ago
Read 2 more answers
What is the different between the simple statement and compound statement ?​
OverLord2011 [107]

Answer:

Following is the difference between Simple and Compound statement; Simple statement (sentence) is one which has only one subject and one predicate. A Compound statement (sentence) is one which has two or more independent clauses consisting of their own subject and predicate.

Explanation:

hope it helps you

Mark as brainliest.

And follow for a follow back

4 0
3 years ago
Which group on the Note Master tab contains the command to add footers to the notes pages?
nasty-shy [4]

Answer:

Place Holders

Explanation:

5 0
3 years ago
Suppose you define a java class as follows: public class test { } in order to compile this program, the source code should be st
likoan [24]
Test.java

The classname and the filename need to match (case sensitive).
5 0
3 years ago
All the following are graphic file formats except<br>HTML<br>BMP<br>png<br>Tiff​
kolbaska11 [484]

Answer:

HTML

Explanation:

HTML is not a graphic file, as it doesn't support graphics. It instead supports text-base, and only text.

~

6 0
3 years ago
Other questions:
  • To determine why a computer program started to function differently, Mel should most likely use data to
    5·2 answers
  • Pretrial services programs are also known as early intervention programs. <br> a. True <br> b. False
    15·1 answer
  • True or false Rough estimates indicate that point suspension of your driver's license can average anywhere between $3,000+ and $
    10·1 answer
  • Computer user support helps people with minor computer problems. <br><br> True or False
    12·1 answer
  • What are the design concepts and assumptions behind a class, an object and the relationship between them? What are the roles met
    9·1 answer
  • After a suspected identity fraud case has been resolved, you should:
    5·1 answer
  • Question
    5·1 answer
  • What do you do to think positive and maintain discipline to play
    5·1 answer
  • The five types of personal computers are: desktops, laptops, tablets, smartphones, and
    9·1 answer
  • What is the definition of Graphic AIDS?.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!