From 1718ccc06c984eaa256e781806e900efbf63171f Mon Sep 17 00:00:00 2001 From: Vicky-Raghuwanshi07 <74697810+Vicky-Raghuwanshi07@users.noreply.github.com> Date: Tue, 5 Oct 2021 18:55:20 +0530 Subject: [PATCH] number_for_loop.py In this you see the parameters in for loop, which are required for the basic knowledge of loops in python. --- python-for-beginners/12 - Loops/number.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/python-for-beginners/12 - Loops/number.py b/python-for-beginners/12 - Loops/number.py index b9d4caad..d3eebd8d 100644 --- a/python-for-beginners/12 - Loops/number.py +++ b/python-for-beginners/12 - Loops/number.py @@ -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