diff --git a/016-For loops.md b/016-For loops.md index 8b13789..7fe2595 100644 --- a/016-For loops.md +++ b/016-For loops.md @@ -1 +1,16 @@ - +#what is a for loop? +A for loop in python is used to repeat a series of instructions until a particular condition is met +It can be used for fixed iterations also. +It must be indented at the end just like if statements +An example is shown below +#using for loops +E.g lets try printing numbers from 1 to 20 using for loop +1.We first put in our values in the range we want to print them +E.g (start,stop) +Note that the stop value stops at the value before the original value +I.e if we are to print 1 to 10,we stop at 11 instead +2.We then print + Soln +1.for i in range(1,21): +Print(i) +#This program after running displays numbers from 1 to 20