For loop automatic increment

Inside the ‘FOR’ loop the n is incremented automatically. Say, n in range (0,10) prints all the numbers upto 9, not 10, why?

Because the inbuild range() function is written in such a way that it should start from first parameter value(here first parameter value is 0) to second parameter value -1(here second parameter value is 10.so it becomes 10 -1 = 9). so that its is printing the values from 0 to 9.
To know more about range() function you can refer this : Python range() Function Explained with Examples

Because it generates numbers up to the stop number but **never includes the stop number in its result. It it inbuilt function in python. It was developed like this to C,C++ users can easily use this.

image
In Python, Using a for loop with range() generates numbers up to the stop number but never includes the stop number in its result. As you can see it starts from 0 and does not print the number 6 but in total it prints 6 numbers as spacing by default is 1.

for (int i = 1; i<=10; i++){
Serial.println(i);
}

This is because the inbuilt range function in python. Let’s take an example to better understanding like for i in range (0, N) here starting index is 0 and ending index is N-1 and incremented by 1 by default.

In python For loop the indexing starts from 0, so in range (0,10) you specify 10 increments. If count 0 as first increment you will end up in getting 10th count on nine and hence the result you are getting is ,
0,1,2,3,4,5,6,7,8,9.
You can refer to python function in more detail
https://www.geeksforgeeks.org/python-range-function/

In Python, Using a for loop with range(n), we can repeat an action a specific number of times. range(n) generates an iterator to progress the integer numbers starting with 0 and ending with (n -1). If the range is range (0,10) , it will print only 0 to 9.

hello @biasbhadra
range() function of For loop is written in such a way that first parameter to second parameters value - 1
for example:
for n in range (0 to 5):
print(n)

it will give you the output like
0
1
2
3
4
because as you can see the range function have two parameters 0 and 5
so it will start from the first parameter i.e 0 till the value of second parameter - 1 i.e 5-1 = 4, Therefore it prints only till number 4 and not number 5

We Give Two Parameter In The Range Function.The Program Will Start Giving You Number From The First Parameter Till The Second Parameter.So If You Want The Number 10 To Printed You Have To Say n in range(0,11)