黑马程序员python教程,8天python从入门到精通,学python看这套就

有没有大佬指正一下 这段代码哪里出错了呀 def list_while_func():
list = ['1', '2', '3', '4', '5', '6', '7','8','9']
list2 = []
index = 0
while index < len(list):
a = list[index]
if a % 2 == 0:
list2.append(a)
index += 1
print(f"通过while循环,从列表:{list}中取出偶数,组成新的列表{list2}")
list_while_func()