蕭瑜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)