Advertisement
Guest User

Untitled

a guest
Dec 13th, 2019
91
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.24 KB | None | 0 0
  1. from time import perf_counter
  2. from scipy import root_scalar
  3.  
  4.  
  5. def printMainMenu(maxIter, tol, partitions):
  6. print('''
  7. Меню:
  8.  
  9. 1 - Поиск корней
  10. 2 - Изменить максимальное число итераций (установлено {:d})
  11. 3 - Изменить значение точности (установлено {:e})
  12. 4 - Изменить число разбиений отрезка (установлено {:d})
  13.  
  14. 0 - Выход
  15. '''.format(maxIter, tol, partitions))
  16.  
  17.  
  18. def rootSearch():
  19. pass
  20.  
  21.  
  22. def main():
  23. maxIter = 100
  24. tol = 0.001
  25. partitions = 10
  26.  
  27. choice = None
  28. while choice != '0':
  29. printMainMenu(maxIter, tol, partititon)
  30. choice = input("Ваш выбор: "); print()
  31. if choice == '1':
  32. rootSearch()
  33. elif choice == '2':
  34. maxIter = int(input("Введите новое максимальное число итераций: "))
  35. elif choice == '3':
  36. tol = float(input("Введите новое значение точности: "))
  37. elif choice == '4':
  38. pastitions = int(input("Введите новое число разбиений отрезка: "))
  39. elif choice == '0':
  40. print("Выход")
  41. else:
  42. print("Неизвестная команда")
  43.  
  44. main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement