New course! Every coder should learn Generative AI!
Try a free lesson0
Can any please explain me 'for loop'
5 Answers
+ 1
By asking this, I suppose that you have a programming knowledge of any language before?
For other language, for loop is
for (var i = 0; i < 10; i++)
For Python, for loop is
for i in range(10):
That's the synatx of for loop in Python, which you have to accept.
If you are working with a list, you can simply
for item in list:
+ 1
Now I see that you are in this lesson.
https://www.sololearn.com/learn/JUMP_LINK__&&__Python__&&__JUMP_LINK/2435/
I see that you are using for loop on list
https://code.sololearn.com/cdwfmj3fa0J7/?ref=app
The third page of this lesson teaches that you can also use for loop on range() for repeating a number of times.
Please don't upvote your own question, and please don't pursue virtual achievements such as badges.
+ 1
Listen i am just asking that why "i in" like words or something else is used in for loop
0
The for loop is used when you know in advance how many times the script should run.
0
Gordon yes you are right i had studied c language first 😋