def get_list_length(numbers):
# 将满足条件的数字添加到一个新的列表
new_list = []
for num in numbers:
if num > 0 and num % 2 == 0 and num % 3 == 0:
new_list.append(num)
# 返回新列表的长度
return len(new_list)
使用示例:
numbers = [1, 2, 3, 6, 8, 9, 12, 13, 18]
list_length = get_list_length(numbers)
print(list_length) # 输出为 3