Python Programming - Functions - Discussion
Discussion Forum : Functions - General Questions (Q.No. 22)
22.
What will be the output of the following code snippet?
def square(x):
return x ** 2
numbers = [1, 2, 3, 4]
squared_numbers = list(map(square, numbers))
print(squared_numbers)
Answer: Option
Explanation:
The
map()
function applies the square
function to each element in the numbers
list.
Discussion:
Be the first person to comment on this question !
Post your comments here:
Quick links
Quantitative Aptitude
Verbal (English)
Reasoning
Programming
Interview
Placement Papers