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
Alice has 1/5 as many miniature cars as Sylvester has slyvester has 35 miniature cats how many miniature cars dose Alice have
garik1379 [7]
Alice has 7 miniature cars
5 0
4 years ago
g Write a program that reads a list of words, and a character. The output of the program is every word in the list of words that
lord [1]

Answer:

Here you go, alter this as you see fit :)

Explanation:

array = []

cnt = 0

while cnt < 11:

   x = input("Enter a word: ")

   array.append(x)

   cnt += 1

   y = input("Add another word?(Y/n):  ")

   if y.lower() == "n":

       break

letter = input("\nChoose a letter: ")

if len(letter) != 1:

   print("Error: too many characters")

   quit()

for n in range(len(array)):

   if letter.lower() in array[n].lower():

       print(array[n], end= ",")

4 0
3 years ago
In the secure development lifecycle, how must the specific security needs of software being developed be defined?- Coding phase
Karo-lina-s [1.5K]

Answer: Requirements phase

Explanation:Requirement phase in the SDL(secure development life-cycle) is the phase where the security is fused with integrity part for any product. This mechanism is done to know about the requirement of the product in the security field. This is done to achieve the completeness in the product and to recover the mistakes that had happened earlier in the product due to security issues.

Other phase given in the option are for making the code, designing the model of product and testing the products aspects respectively.

4 0
3 years ago
Image
Eduardwww [97]

Answer:

B. x = 90

Explanation:

  • 180 = 135 + y
  • y = 45
  • 45 + 45 = 90
5 0
3 years ago
Read 2 more answers
The shortcut key to quickly create a column chart is
Naddika [18.5K]

Answer:

Excel allowed you to create a chart by selecting the data and pressing the F11 key. In response, Excel created a default chart on a new sheet. You can use also Alt+F1 shortcut, which creates a default chart as a chart object embedded in the current worksheet.

Explanation:

7 0
4 years ago
Other questions:
  • Which cloud computing service model gives software developers access to multiple operating systems for testing?
    5·1 answer
  • How do you plan to keep your personal and professional connections and activity seperate on various social media platforms?
    15·1 answer
  • Does an android tablet have a hard drive
    7·1 answer
  • Write a program that accepts 5 number and arrange them in ascending order​
    7·1 answer
  • HELP PLEASE ASAP!!! Does anyone know how to fix a broken iPhone which when I connect it to the charger it comes up with the Appl
    5·1 answer
  • Who wants brainliest? First to answer gets it....
    12·2 answers
  • 10. Two technicians are discussing recycling specifications for refrigerant. Technician A says that refrigerant oil with 5,000 p
    9·1 answer
  • What types of activities are ideal for a robot to perform?
    6·1 answer
  • Where can i check on an acer chromebook to see what version of java is installed.
    13·1 answer
  • What are two best practices for creating ads? (Choose two.) Select All Correct Responses Implement one ad per ad group per keywo
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!