范雅惠Lambda匿名函式google colaboratory
def x(m,n): #定義自訂函數x
newList = []
for i in m : #迴圈將m的元素每個都執行
newList.append(n(i))
return newList #傳回去
m=['貓','范雅惠','鴨子','你','他']
n=lambda y: y + '是聰明人'
print(x(m,n))
for i in x(m,n):
print(i)
def x(m,n): #定義自訂函數x
newList = []
for i in m : #迴圈將m的元素每個都執行
newList.append(n(i))
return newList #傳回去
m=['貓','范雅惠','鴨子','你','他']
n=lambda y: y + '是聰明人'
print(x(m,n))
for i in x(m,n):
print(i)