Advertisement
Oppaceted

drawing

May 27th, 2024
588
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.02 KB | None | 0 0
  1. from tabulate import tabulate
  2.  
  3. def ShowFunctional(N: int, Functional_koeff: list) -> None:
  4.     for i in range(N):
  5.         print(f"{Functional_koeff[i]}x_{i+1}", end= "")
  6.         if i == N-1:    #в range создается N-1 элементов (начинаем с нуля) => берем i == N-1
  7.             print()
  8.         else:
  9.             print("+", end = "")
  10.  
  11. def ShowMatrixElement (A: list, i: int, j: int) -> None:
  12.     for el_i in range(len(A)):
  13.         print ("(", end=" ")
  14.         for el_j in range(len(A[i])):
  15.             print( "   X" if (el_i == i and el_j == j) else f"{A[el_i][el_j]:>4}" , end=" ")
  16.         print (")")
  17.    
  18. def ShowTable(A: list, B: list,  column: list, input_headers: list, input_W: list) -> None:
  19.     headers = [''] + input_headers + ['B']
  20.     data = []
  21.     for i in range(len(A)):
  22.         data.append([column[i]])
  23.         data[i] = data[i] + [i for i in A[i]] + [B[i]]
  24.     data += [['W'] + input_W]
  25.     print( tabulate(tabular_data= data, headers=headers, tablefmt="grid") )
  26.    
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement