龔育婷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)
https://colab.research.google.com/#
留言
張貼留言