Exemple #1
0
     print('Wrong, try again.')
     task_type = input('Enter task type(min or max):\n')
 print('How you want to enter data?:\n'
       '\t1)From file;\n'
       '\t2)From keyboard;')
 insert_type = input()
 while insert_type not in ('1', '2'):
     insert_type = input()
     if insert_type not in ('1', '2'):
         print('Error, try again\n')
 if insert_type == '1':
     print('Careful! Matrix in file should be square. One string in file - one row of matrix, '
           'entry splitter - ";".\n')
     matr_file = input('Enter path to file(full):\n')
     task = Data(matr_file, task_type, from_file=True)
     task.solve()
     print('Answer:', task.result)
 elif insert_type == '2':
     matrix = []
     dim = input('Enter dimension(max=10):\n')
     while int(dim) not in range(1, 11):
         print('Wrong, try again\n')
         dim = input()
     print('Enter matrix(1 row per string, entries splitter is whitespace:')
     for i in range(int(dim)):
         row = input()
         matrix.append(list(map(float, row.split(' '))))
     matrix = np.array(matrix)
     task = Data(matrix, task_type)
     start = time.clock()
     task.solve()