
- 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 program to compute the power by Index element in List
When it is required to compute the power by index element in a list, the simple iteration along with the ‘**’ operator is used.
Example
Below is a demonstration of the same
my_list = [62, 18, 12, 63, 44, 75] print("The list is :") print(my_list) my_result = [] for my_index, elem in enumerate(my_list): my_result.append(elem ** my_index) print("The result is :") print(my_result)
Output
The list is : [62, 18, 12, 63, 44, 75] The result is : [1, 18, 144, 250047, 3748096, 2373046875]
Explanation
A list is defined and is displayed on the console.
An empty list is defined.
The list is iterated over and the element raised to the power of the index is appended to the empty list.
This is displayed as output on the console.
- Related Articles
- How to remove an element from a list by index in Python?
- Python – Negative index of Element in List
- Program to find index, where we can insert element to keep list sorted in Python
- C# program to find the index of an element in a List
- Program to get maximum value of power of a list by rearranging elements in Python
- How to find what is the index of an element in a list in Python?
- Program to Find Out the Maximum Final Power of a List in Python
- Python program to covert tuple into list by adding the given string after every element
- Python program to convert tuple into list by adding the given string after every element
- Program to reverse a list by list slicing in Python
- Python Program to find the cube of each list element
- Program to find smallest index for which array element is also same as index in Python
- Python – Replace value by Kth index value in Dictionary List
- Python program to Sort a List of Tuples in Increasing Order by the Last Element in Each Tuple
- Python Pandas - Compute indexer and mask for new index given the current index

Advertisements