loops
-
Refer Here for loops in python or Refer Here.
-
while
while "<expression>":
body..
...
...
- while executes the body as long as expression is true
- Project euler problem 1 using while
index = 1
sum = 0
while index < 10:
if index%3 == 0 or index%5 == 0:
sum += index
index += 1
print(sum)
- For: Refer Here
for item in <collection/sequence>:
body
-
Lets learn a python function to generate numerical sequence
-
Refer Here for loops program
-
Refer Here for project euler problem 2 solution
