Discuss / Python / 交作业

交作业

Topic source
# _*_ coding : utf-8 _*_
# 2020/4/1
# 用if语句修改并完善列表生成式(将L1中的str大写变为小写并输出)。
L1 = ['Hello', 'World', 18, 'Apple', None]
L2 = [x.lower() for x in L1 if isinstance(x,str)]

题目内容稍微有点小歧义,因为没有定义输出的list内容


  • 1

Reply