列表中包含 500000
元素,即。size of list
.
而列表中的每个元素都应该小于 1500000
.
l1 = [1]*500000
for i in range(len(l1)):
if l1[i] <= 1500000:
print("valid)
上面的方法会花费更多的时间来循环(may error out if size is greater than 500000
)我知道这不是正确的方法。可能是 itertools
或更好的东西将是理想的。
Could you please help me to handle in efficient way ?
如果用户输入了这样的值,如何读取它们?specific/faster
接受这些值的方法?input()