以下未完成的函数可实现不同的功能
def func(lst1): s1, s2 = Stack(), Stack() for item in lst1: s1.push(item) lst2 = [] while not s1.isEmpty(): ### 在此进行代码填空 ### return lst2# 测试print(func([1, 3, 5, 7, 9]))在下列选项中,填空内容与分别对列表[1, 3, 5, 7, 9]调用结果相对应的选项有?
A、lst2.append(s1.pop())
[9, 7, 5, 3, 1]
B、lst2.append(s1.pop()) [1, 3, 5, 7, 9]
C、
while not s1.isEmpty(): s2.push(s1.pop())lst2.append(s2.pop())while not s2.isEmpty(): s1.push(s2.pop())[1, 3, 5, 7, 9]
D、while not s1.isEmpty(): s2.push(s1.pop())lst2.append(s2.pop())while not s2.isEmpty(): s1.push(s2.pop())
[9, 7, 5, 3, 1]
E、lst2.append(s1.peek())死循环,无法运行
F、lst2.append(s1.peek())[9, 9, 9, 9, 9]
G、for i in range(s1.pop()): s2.push(i)lst2.append(s2.size())
[9, 16, 21, 24, 25]
H、for i in range(s1.pop()): s2.push(i)lst2.append(s2.size())[1, 4, 9, 16, 25]
def func(lst1): s1, s2 = Stack(), Stack() for item in lst1: s1.push(item) lst2 = [] while not s1.isEmpty(): ### 在此进行代码填空 ### return lst2# 测试print(func([1, 3, 5, 7, 9]))在下列选项中,填空内容与分别对列表[1, 3, 5, 7, 9]调用结果相对应的选项有?
A、lst2.append(s1.pop())
[9, 7, 5, 3, 1]
B、lst2.append(s1.pop()) [1, 3, 5, 7, 9]
C、
while not s1.isEmpty(): s2.push(s1.pop())lst2.append(s2.pop())while not s2.isEmpty(): s1.push(s2.pop())[1, 3, 5, 7, 9]
D、while not s1.isEmpty(): s2.push(s1.pop())lst2.append(s2.pop())while not s2.isEmpty(): s1.push(s2.pop())
[9, 7, 5, 3, 1]
E、lst2.append(s1.peek())死循环,无法运行
F、lst2.append(s1.peek())[9, 9, 9, 9, 9]
G、for i in range(s1.pop()): s2.push(i)lst2.append(s2.size())
[9, 16, 21, 24, 25]
H、for i in range(s1.pop()): s2.push(i)lst2.append(s2.size())[1, 4, 9, 16, 25]