Search
 
SCRIPT & CODE EXAMPLE
 

PYTHON

use lambda with map in python

# Double all numbers using map and lambda
  
numbers = (1, 2, 3, 4)
result = map(lambda x: x + x, numbers)
print(list(result))

# output :-

# 1 + 1 = 2 / 2 + 2 = 4 / 3 + 3 = 6 / 4 + 4 = 8

[2, 4, 6, 8]
Comment

map function using lambda in python

# Map function 

nums1 = [2,3,5,6,76,4,3,2]
sq = list(map(lambda a : a*a, nums1))
print(sq)
Comment

python lambda function map

res = list(map(lambda x : x**2, range(1, 101)))
print(res)
Comment

PREVIOUS NEXT
Code Example
Python :: count values pandas 
Python :: append file to list python 
Python :: unnamed 0 pandas 
Python :: python __gt__ 
Python :: compute eigenvalue python 
Python :: icon tkiner 
Python :: print a text in python 
Python :: python live video streaming flask 
Python :: generate random number python 
Python :: Get the Type 
Python :: colab pip 
Python :: python make dictionary based on list 
Python :: flask redirect to url 
Python :: import matplotlib 
Python :: python empty text file 
Python :: python replace string in file 
Python :: python hello world web application 
Python :: show all columns pandas jupyter notebook 
Python :: python make a new window 
Python :: how to shutdown a windows 10 computer using python 
Python :: replace number with string python 
Python :: python get number of days 
Python :: install pip with pacman linux 
Python :: ignoring warnings 
Python :: convert decimal to binary in python 
Python :: python how to get current line number 
Python :: how to replace first line of a textfile python 
Python :: check if string has digits python 
Python :: python ddos 
Python :: raising exceptions in python 
ADD CONTENT
Topic
Content
Source link
Name
6+6 =