Skip to content

016-for loops.md #3

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 16 additions & 1 deletion 016-For loops.md
Original file line number Diff line number Diff line change
@@ -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