- Trending Categories
- Data Structure
- Operating System
- C Programming
- 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 find the cube of each list element
When it is required to find the cube of each list element, a simple iteration and the ‘append’ method are used.
Below is a demonstration of the same
my_list = [45, 31, 22, 48, 59, 99, 0] print("The list is :") print(my_list) my_result =  for i in my_list: my_result.append(i*i*i) print("The resultant list is :") print(my_result)
The list is : [45, 31, 22, 48, 59, 99, 0] The resultant list is : [91125, 29791, 10648, 110592, 205379, 970299, 0]
A list is defined and is displayed on the console.
An empty list is defined.
The original list is iterated over.
Every element is multiplied with itself thrice.
This result is appended to the empty list.
This is the result that is displayed on the console.
- C# Program to find the cube of elements in a list
- Python program to get the indices of each element of one list in another list
- Cube each element in a Numpy array
- Python program to create a list of tuples from the given list having the number and its cube in each tuple
- Program to find replicated list by replicating each element n times
- Program to find sum of concatenated pairs of all each element in a list in Python?\n
- Python – Find the frequency of numbers greater than each element in a list
- Program to find sum of the minimums of each sublist from a list in Python
- Adding K to each element in a Python list of integers
- Python Program to assign each list element value equal to its magnitude order
- Python program to find the group sum till each K in a list
- Java program to find the cube root of a given number
- Create a list of tuples from given list having number and its cube in each tuple using Python
- Program to find smallest intersecting element of each row in a matrix in Python
- Python Program to Find the Largest Element in a Doubly Linked List