测评会员优惠活动进行中 · 开通 VIP,有效期内测评不限次 VIP 优惠中 · 测评不限次 立即查看

A68711. (多选)阅读下面代码,说法正确的是?def transform(myls)

多选题

题目描述

(多选)阅读下面代码,说法正确的是?

def transform(myls):
    tmp_ls = []
    for num in myls:
        if num > 0 and num % 2 == 0:
            tmp_ls.append(num ** 2)
        elif num > 0 and num % 2 != 0:
            tmp_ls.append(num + 3)
        elif num < 0:
            tmp_ls.append(num * -1)
    return tmp_ls
    
ls = [-2,2,3,-4,0,5,6]
print(transform(ls))

选项(多选)