单选题 适中
#4681

下列代码的执行结果是?() mylist = [ 'Failure' , 'is' , 'the' , 'mother' , 'of' , 'success'…

下列代码的执行结果是?()

mylist=['Failure','is','the','mother','of','success']
for x in mylist[:]:
    if len(x)<=3:
        mylist.append(x)
print(mylist)
未登录也能判分,登录后才会记录
答案与解析
正确答案:D
解析

此题循环获取列表mylist的全切片后判断每个元素的长度,长度小于并等于3时,添加到mylist中,因此结果为['Failure', 'is', 'the', 'mother', 'of', 'success', 'is', 'the', 'of']