add counting and filtered-count patterns in 1.1.3

pull/357/head
Eric Douglas 2014-05-22 18:38:48 -03:00
parent 89baff3f40
commit 62b7aa9967
2 changed files with 22 additions and 0 deletions

View File

@ -1 +1,23 @@
# Loops - http://beastie.cs.ua.edu/cs150/book/index_14.html
i = 0
while i < 5:
print i
i += 1
# Other loops
for i in range(0, 5, 1): # 5 exclusive
print i
# The counting pattern
count = 0
for i in range(0, len(items), 1):
count += 1
# The filtered-count pattern
count = 0
for i in range(0, len(items), 1):
if items[i] % 2 == 0:
count += 1