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
What is a spreadsheet​
Delicious77 [7]
A spreadsheet function that indicates the average of a group of numbers in a range.
8 0
3 years ago
What is the most important job of a web server?
attashe74 [19]

Answer:

Provide requested web pages to clients; the other tasks listed there are secondary to that.

6 0
2 years ago
Read 2 more answers
A browser is an example of a<br>​
Inessa [10]

Answer:

User Interface, Website

3 0
2 years ago
Using positive self talk is a great way to
lora16 [44]
Boost your self esteem and confidence.
7 0
3 years ago
Read 2 more answers
Match the feature to the network architecture,
pochemuha

Answer:

Answer is:  

Client-Server Network

  • expensive to set up
  • has a central server
  • easy to track files
  • useful for a large organization

Peer-to-peer Network

  • useful for a small organization
  • difficult to track files
  • inexpensive to set up
  • does not have a central server

Explanation:

<em>Client-Server Network is ideal for bigger network set up like offices and companies where there will be a central server involved with several clients to access and connected with the server. This is the normal network set up to companies. While, Peer to peer network is ideal for much smaller network, which consists of only two computers to communicate and share files. This network is normally temporary and inexpensive since in only works with two computers.</em>

7 0
3 years ago
Other questions:
  • Which one of the following downloads and uploads files to and from a server? A. Client B. Internet protocol C. Server D. Worksta
    9·1 answer
  • The standard qwerty keyboard has 47 keys that can place characters on the screen. each of these keys can also display a second c
    13·2 answers
  • How do I download the Microsoft word on my Hp probook
    8·2 answers
  • Which is a false statement considering copyright law?
    13·2 answers
  • The signature area in a cover letter includes the sender's first and last name, followed by his/her job title (if applicable). *
    13·1 answer
  • Which factors are involved in search engine optimization​
    10·1 answer
  • Write a calculator program that will allow only addition, subtraction, multiplication &amp; division. Have the
    7·1 answer
  • Any correct answers will be helpful.
    13·1 answer
  • What is the purpose of a format painter in Word?
    15·2 answers
  • Which structural semantic will this HTML code snippet form?
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!