- Python Basic Tutorial
- Python - Home
- Python - Overview
- Python - Environment Setup
- Python - Basic Syntax
- Python - Comments
- Python - Variables
- Python - Data Types
- Python - Operators
- Python - Decision Making
- Python - Loops
- Python - Numbers
- Python - Strings
- Python - Lists
- Python - Tuples
- Python - Dictionary
- Python - Date & Time
- Python - Functions
- Python - Modules
- Python - Files I/O
- Python - Exceptions
- Python Advanced Tutorial
- Python - Classes/Objects
- Python - Reg Expressions
- Python - CGI Programming
- Python - Database Access
- Python - Networking
- Python - Sending Email
- Python - Multithreading
- Python - XML Processing
- Python - GUI Programming
- Python - Further Extensions
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.
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)
The list is : [3, -6, 3, -1, 23, -11, 0, -8] The result is : 3349
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 Articles
- Python Program to Compute a Polynomial Equation given that the Coefficients of the Polynomial are stored in a List
- C program to compute the polynomial regression algorithm
- Compute the roots of a polynomial in Python
- Compute the roots of a polynomial with given complex roots in Python
- Python Program to Input a Number n and Compute n+nn+nnn
- Program to compute gcd of two numbers recursively in Python
- Python Program to Compute Simple Interest Given all the Required Values
- Python program to compute the power by Index element in List
- Write a program in Python to compute autocorrelation between series and number of lags
- 8085 Program to compute LCM
- C++ Program to Compute Determinant of a Matrix
- Program to find out the value of a given equation in Python
- Raise a polynomial to a power in Python
- C program to compute geometric progression
- C program to compute linear regression