Загрузка...

Algorithm of calculator.py Program – State V: Expression with a Variable X

The video demonstrates the state of calculator.py program when the user enters an expression with a variable X.
The process is similar to the one for the expression without the variable X.
1. When the user enters an expression, the program validates that the user entry matches the RegEx pattern;
2. If the user entry is valid, the program retrieves each operator and number/function (with the arguments) from the entry using an RegEx iterator and stores them in a list. If the expression contains the variable X, the program replaces the variable X with the result from the previous computation (or 0 if none) and stores the value of X in the list as a regular value.
3. After the iterator reaches the end of the entry string, the program makes further validation that the expression entered by the user follows the correct syntax.
4. If the expression is valid, the program converts the expression to reverse Polish notation and performs the computation.
5. After the computation is performed the result is saved in the variable _x and printed to the user.

Видео Algorithm of calculator.py Program – State V: Expression with a Variable X канала Mike Ignatyev
Страницу в закладки Мои закладки
Все заметки Новая заметка Страницу в заметки

На информационно-развлекательном портале SALDA.WS применяются cookie-файлы. Нажимая кнопку Принять, вы подтверждаете свое согласие на их использование.

Об использовании CookiesПринять