看评论区几乎用while循环写这题,我就用for循环写写吧
list = ['apple', 'ice cream', 'watermelon', 'chips', 'hotdogs', 'hotpot']
for i in range(7):
list.pop(-1)
print(list)
##前几遍没写下面这两行就通过不了
if list==[]:
break
list = ['apple', 'ice cream', 'watermelon', 'chips', 'hotdogs', 'hotpot']
for i in range(7):
list.pop(-1)
print(list)
##前几遍没写下面这两行就通过不了
if list==[]:
break
相关推荐