我有一個包含大量數據的列表。如果我想設置一個if語句下面的僞代碼:Python數據[i]數據[i + 100] <#(例如50)
if data[i] to data[i+100] < 50:
data[i] == 1
是否有我不需要像下面輸入一些東西什麼辦法?
data[i] <50 and data[i+1] <50 and data[i+2] <50 and .... and data[i+100] <50:
因爲它太費時。如果有人知道更快的方式,請讓我知道。感謝!