prompt: We are currently solving the following issue within our repository. Here is the issue text:
  --- BEGIN ISSUE ---
  Unnecessary Loop 
  https://github.com/TheAlgorithms/Python/blob/4e0184a41dd3e4838da484057d25e17234353da0/dynamic_programming/matrix_chain_order.py#L12-L15
  
  `Line 12` creates a NxN Matrix that **contains 0**. So there is no need for `Line 14-15`
  
  --- END ISSUE ---
  
  Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
  --- BEGIN FILES ---
  Path: `dynamic_programming/matrix_chain_order.py`
  Content:
  ```
  1 from __future__ import print_function
  2 
  3 import sys
  4 '''
  5 Dynamic Programming
  6 Implementation of Matrix Chain Multiplication
  7 Time Complexity: O(n^3)
  8 Space Complexity: O(n^2)
  9 '''
  10 def MatrixChainOrder(array):
  11     N=len(array)
  12     Matrix=[[0 for x in range(N)] for x in range(N)]
  13     Sol=[[0 for x in range(N)] for x in range(N)]
  14     for i in range(1,N):
  15         Matrix[i][i]=0
  16 
  17     for ChainLength in range(2,N):
  18         for a in range(1,N-ChainLength+1):
  19             b = a+ChainLength-1
  20 
  21             Matrix[a][b] = sys.maxsize
  22             for c in range(a , b):
  23                 cost = Matrix[a][c] + Matrix[c+1][b] + array[a-1]*array[c]*array[b]
  24                 if cost < Matrix[a][b]:
  25                     Matrix[a][b] = cost
  26                     Sol[a][b] = c
  27     return Matrix , Sol
  28 #Print order of matrix with Ai as Matrix
  29 def PrintOptimalSolution(OptimalSolution,i,j):
  30     if i==j:
  31         print("A" + str(i),end = " ")
  32     else:
  33         print("(",end = " ")
  34         PrintOptimalSolution(OptimalSolution,i,OptimalSolution[i][j])
  35         PrintOptimalSolution(OptimalSolution,OptimalSolution[i][j]+1,j)
  36         print(")",end = " ")
  37 
  38 def main():
  39     array=[30,35,15,5,10,20,25]
  40     n=len(array)
  41     #Size of matrix created from above array will be
  42     # 30*35 35*15 15*5 5*10 10*20 20*25
  43     Matrix , OptimalSolution = MatrixChainOrder(array)
  44 
  45     print("No. of Operation required: "+str((Matrix[1][n-1])))
  46     PrintOptimalSolution(OptimalSolution,1,n-1)
  47 if __name__ == '__main__':
  48     main()
  49
  ```
  --- END FILES ---
  
  Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.
  
  Here is an example:
  
  ```diff
  diff --git a/examples/server_async.py b/examples/server_async.py
  --- a/examples/server_async.py
  +++ b/examples/server_async.py
  @@ -313,4 +313,4 @@
   
   
   if __name__ == "__main__":
  -    asyncio.run(run_async_server("."), debug=True)
  +    asyncio.run(run_async_server(), debug=True)
  diff --git a/examples/server_sync.py b/examples/server_sync.py
  --- a/examples/server_sync.py
  +++ b/examples/server_sync.py
  @@ -313,5 +313,5 @@
   
   
   if __name__ == "__main__":
  -    server = run_sync_server(".")
  +    server = run_sync_server()
       server.shutdown()
  
  ```
  
golden_diff: diff --git a/dynamic_programming/matrix_chain_order.py b/dynamic_programming/matrix_chain_order.py
  --- a/dynamic_programming/matrix_chain_order.py
  +++ b/dynamic_programming/matrix_chain_order.py
  @@ -11,8 +11,6 @@
       N=len(array)
       Matrix=[[0 for x in range(N)] for x in range(N)]
       Sol=[[0 for x in range(N)] for x in range(N)]
  -    for i in range(1,N):
  -        Matrix[i][i]=0
   
       for ChainLength in range(2,N):
           for a in range(1,N-ChainLength+1):
  
verification_info: {"golden_diff": "diff --git a/dynamic_programming/matrix_chain_order.py b/dynamic_programming/matrix_chain_order.py\n--- a/dynamic_programming/matrix_chain_order.py\n+++ b/dynamic_programming/matrix_chain_order.py\n@@ -11,8 +11,6 @@\n     N=len(array)\n     Matrix=[[0 for x in range(N)] for x in range(N)]\n     Sol=[[0 for x in range(N)] for x in range(N)]\n-    for i in range(1,N):\n-        Matrix[i][i]=0\n \n     for ChainLength in range(2,N):\n         for a in range(1,N-ChainLength+1):\n", "issue": "Unnecessary Loop \nhttps://github.com/TheAlgorithms/Python/blob/4e0184a41dd3e4838da484057d25e17234353da0/dynamic_programming/matrix_chain_order.py#L12-L15\r\n\r\n`Line 12` creates a NxN Matrix that **contains 0**. So there is no need for `Line 14-15`\n", "before_files": [{"content": "from __future__ import print_function\n\nimport sys\n'''\nDynamic Programming\nImplementation of Matrix Chain Multiplication\nTime Complexity: O(n^3)\nSpace Complexity: O(n^2)\n'''\ndef MatrixChainOrder(array):\n    N=len(array)\n    Matrix=[[0 for x in range(N)] for x in range(N)]\n    Sol=[[0 for x in range(N)] for x in range(N)]\n    for i in range(1,N):\n        Matrix[i][i]=0\n\n    for ChainLength in range(2,N):\n        for a in range(1,N-ChainLength+1):\n            b = a+ChainLength-1\n\n            Matrix[a][b] = sys.maxsize\n            for c in range(a , b):\n                cost = Matrix[a][c] + Matrix[c+1][b] + array[a-1]*array[c]*array[b]\n                if cost < Matrix[a][b]:\n                    Matrix[a][b] = cost\n                    Sol[a][b] = c\n    return Matrix , Sol\n#Print order of matrix with Ai as Matrix\ndef PrintOptimalSolution(OptimalSolution,i,j):\n    if i==j:\n        print(\"A\" + str(i),end = \" \")\n    else:\n        print(\"(\",end = \" \")\n        PrintOptimalSolution(OptimalSolution,i,OptimalSolution[i][j])\n        PrintOptimalSolution(OptimalSolution,OptimalSolution[i][j]+1,j)\n        print(\")\",end = \" \")\n\ndef main():\n    array=[30,35,15,5,10,20,25]\n    n=len(array)\n    #Size of matrix created from above array will be\n    # 30*35 35*15 15*5 5*10 10*20 20*25\n    Matrix , OptimalSolution = MatrixChainOrder(array)\n\n    print(\"No. of Operation required: \"+str((Matrix[1][n-1])))\n    PrintOptimalSolution(OptimalSolution,1,n-1)\nif __name__ == '__main__':\n    main()\n", "path": "dynamic_programming/matrix_chain_order.py"}], "after_files": [{"content": "from __future__ import print_function\n\nimport sys\n'''\nDynamic Programming\nImplementation of Matrix Chain Multiplication\nTime Complexity: O(n^3)\nSpace Complexity: O(n^2)\n'''\ndef MatrixChainOrder(array):\n    N=len(array)\n    Matrix=[[0 for x in range(N)] for x in range(N)]\n    Sol=[[0 for x in range(N)] for x in range(N)]\n\n    for ChainLength in range(2,N):\n        for a in range(1,N-ChainLength+1):\n            b = a+ChainLength-1\n\n            Matrix[a][b] = sys.maxsize\n            for c in range(a , b):\n                cost = Matrix[a][c] + Matrix[c+1][b] + array[a-1]*array[c]*array[b]\n                if cost < Matrix[a][b]:\n                    Matrix[a][b] = cost\n                    Sol[a][b] = c\n    return Matrix , Sol\n#Print order of matrix with Ai as Matrix\ndef PrintOptimalSolution(OptimalSolution,i,j):\n    if i==j:\n        print(\"A\" + str(i),end = \" \")\n    else:\n        print(\"(\",end = \" \")\n        PrintOptimalSolution(OptimalSolution,i,OptimalSolution[i][j])\n        PrintOptimalSolution(OptimalSolution,OptimalSolution[i][j]+1,j)\n        print(\")\",end = \" \")\n\ndef main():\n    array=[30,35,15,5,10,20,25]\n    n=len(array)\n    #Size of matrix created from above array will be\n    # 30*35 35*15 15*5 5*10 10*20 20*25\n    Matrix , OptimalSolution = MatrixChainOrder(array)\n\n    print(\"No. of Operation required: \"+str((Matrix[1][n-1])))\n    PrintOptimalSolution(OptimalSolution,1,n-1)\nif __name__ == '__main__':\n    main()\n", "path": "dynamic_programming/matrix_chain_order.py"}]}