【发布时间】:2020-04-24 01:51:21
【问题描述】:
我是 python 新手,我刚刚了解了“While Loops”所以我正在尝试这段代码,它将一个列表的值复制到另一个列表中
>>> squares=['red','red','red','blue','red','red']
>>> new_squares=[];
>>> i=0
>>> while(squares[i]=='red')
... new_squares.append(squares[i])
现在是错误发生的时候
File "<stdin>", line 2
new_squares.append(squares[i])
^
IndentationError: expected an indented block
为什么会这样,我在课程中使用了相同的代码,只是将值从“橙色”更改为“红色”
【问题讨论】:
标签: python python-2.7