?887 2022-11-05 08:12 采纳率: 97.8%
浏览 21
已结题

python定义函数

def get_2d_list_of_vowels_count(list_of_lists):

img

img

  • 写回答

2条回答 默认 最新

  • chuifengde 2022-11-05 08:42
    关注
    def get_2d_list_of_vowels_count(list_of_lists):
        return list(map(lambda x: [len([j for j in i if j in 'aeiou']) for i in x], list_of_lists))
    
    res = get_2d_list_of_vowels_count([['fish', 'barrel', 'like'], ['apple', 'orange']])
    print(res)
    --result
    [[1, 2, 2], [2, 3]]
    
    
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

问题事件

  • 系统已结题 11月13日
  • 已采纳回答 11月5日
  • 创建了问题 11月5日