Here we use map(), which generate another list of square using
list - [1,2,3,4,5,6,7,8,9,10]
Solution:
li = [1,2,3,4,5,6,7,8,9,10]
squaredNumbers = map(lambda x: x**2, li)
print(squaredNumbers)
Output:
[1, 4, 9, 16, 25, 36, 49, 64, 81, 100]
Our aim to provide top rated python program which help to learn python and improve your coding skills.
Other related topic-
For given latitude value check the location on equator in python
Calculate distance between two points on Earth the latitute and longitude given in degrees
Write a program of Rational Numbers Addition,Subtraction, Multiplication, Division in python
Design and implement a "Golf Club" program that records information about golfers and tournaments
Concatenate First, mid and last character of String in Python
A set of utilities to manipulate polynomials, Addition, subtraction, Multiplication and evaluation
If you want to learn Codersarts python program Forum then go to the this link