'Count from 20-100
I use Jupiter to read a CSV file. Then, in a specific column, I read all the numbers, from 20 to 100. I want to go through the whole column and see if there is a sequence of numbers running from 20 to 100 in jumps of 5: 20,25,30,35..95, and 100. If this happens, the count goes up by 1.
index = 20
count = 0
i = 0
while i < len(nparr):
if nparr[i] == index:
if index == 100:
count += 1
index = 20
i+=1
else:
while nparr[i] == index:
i +=1
index +=5
else:
index = 20
i+=1
count
The output should be 1 Right Now, I get 0
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
