L=['Bart','Lisa','Adam']
a=2
while a==0:
b=L[a]
print('hello',b)
a-=1
(我认为这题就是按索引来返回人名,a代表索引,索引为0时结束循环,为什么写a==0没有结果 只能用a>=0呢?)
缩进方面我都做好了 上边忘记打出来了
while的条件判断为真,则执行,你的a初始赋值为2,则这个while条件为假,则直接跳出循环
Sign in to make a reply
用户5934215828
L=['Bart','Lisa','Adam']
a=2
while a==0:
b=L[a]
print('hello',b)
a-=1
(我认为这题就是按索引来返回人名,a代表索引,索引为0时结束循环,为什么写a==0没有结果 只能用a>=0呢?)