From 5bce3d4361e3742f0dcc35161db3408bb706442e Mon Sep 17 00:00:00 2001 From: yabagiibrahim <55027665+yabagiibrahim@users.noreply.github.com> Date: Mon, 7 Oct 2019 02:25:25 +0100 Subject: [PATCH] 016-for loops.md --- 016-For loops.md | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) 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