Python program to print the square of all elements in a list
In this tutorial, we will learn How to square the elements of a list in Python.
Explanation ✏
First, create a list of n numbers
Then, create another blank list for storing a square list
Now, with the help of for loop append each number in the blan...
dx4iot.hashnode.dev1 min read
Siddharth Chandra
Senior Software Engineer
One more way is to use lazy evaluation:
map(lambda x: x*x, num))