我有一张单子
masterList = [42,28,14,28,14,28,42,14]
此列表用于根据上述顺序生成第二个较长的列表。我希望通过该列表迭代并自动通过该列表重申,直到满足条件为止。你知道吗
对于回复,抱歉这里有一个示例:-
templateList = [42,28,14,28,14,28,42,14]
newList =[]
while newList < 1000:
for i in templateList:
a = newList[-1] + i
newList.append(a)
print(newList)
我想要的结果是: 新列表=[84、140、168、224、252、308、392、420、504、560、588、644、672、728、812、840、924、980]
也许这就是你想要的:
假设
condition
是您想要的条件,一种可能性是:内部循环是for循环,它遍历列表。外部循环确保在for循环结束后,另一个for循环开始(前提是条件保持为true)。你知道吗
相关问题 更多 >
编程相关推荐