Skip to content
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

number_for_loop.py #82

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
13 changes: 9 additions & 4 deletions python-for-beginners/12 - Loops/number.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,11 @@
# range creates an array
# First parameter is the starter
# Second indicates the number of numbers to create
# range() returns a sequence of numbers
# optional( by default it starts with 0) : First parameter is the starter
# Second parameter(Required) indicates where it need to stop but that number will be exculded in range()
# If you want to include the last number then just add by 1
# range(0, 2) creates [0, 1]
for index in range(0, 2):
# Third Parameter(Optional) : This number will tell the program to take a jump(increment/decrement) in that range. By default the value for jump is +1.

for index in range(10):
print(index)

#This program will print the number from 0 to 9 in new lines. Since the 10 is exculded it will not print it