

- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Python program to compute a Polynomial Equation
When it is required to compute a polynomial equation, a simple iteration along with the ‘*’ operator is used.
Example
Below is a demonstration of the same
my_list = [3, -6, 3, -1, 23, -11, 0, -8] print("The list is :") print(my_list) x = 3 my_list_length = len(my_list) my_result = 0 for i in range(my_list_length): my_sum = my_list[i] for j in range(my_list_length - i - 1): my_sum = my_sum * x my_result = my_result + my_sum print("The result is :") print(my_result)
Output
The list is : [3, -6, 3, -1, 23, -11, 0, -8] The result is : 3349
Explanation
A list is defined and is displayed on the console.
A variable is assigned an integer value.
The length of the list is assigned to a variable.
A variable is initialized to 0.
The list is iterated over, and the elements are assigned to a variable.
The list is iterated again, and the variable previously used is multiplied with the integer previously defined.
The variable initialized to 0 is added to the integer.
This is the output that is displayed on the console.
- Related Questions & Answers
- Python Program to Compute a Polynomial Equation given that the Coefficients of the Polynomial are stored in a List
- Compute the roots of a polynomial in Python
- C program to compute the polynomial regression algorithm
- Compute the roots of a polynomial with given complex roots in Python
- Program to find out the value of a given equation in Python
- Program to find max value of an equation in Python
- Integrate a polynomial in Python
- Differentiate a polynomial in Python
- Raise a polynomial to a power in Python
- Java program to find the roots of a quadratic equation
- C++ Program to Find All Roots of a Quadratic Equation
- Java Program to Find all Roots of a Quadratic Equation
- Convert a Chebyshev series to a polynomial in Python
- Convert a polynomial to a Chebyshev series in Python
- Convert a Hermite series to a polynomial in Python
Advertisements