The Python for loop is used to iterate over an element of sequence or data structure ( List, Tuple, String, Dictionary).
Classification of for loop using different type:-
1] Using Range(N) Function
Syntax-
range(start, stop, step size)
Start and Step size is optional.
By default, Start is 0 and Step size is 1 if not provided
If we use range(n), where n is an integer, then it will print an integer from 0 to n-1.
For example-
Using range(7), it will print an integer from 0 to 6
# | Program | Language |
---|---|---|
1 | Python 3 | |
2 | Python 3 | |
3 | Python 3 | |
4 | Python 3 | |
5 | Python 3 | |
6 | Python 3 | |
7 | Python 3 | |
8 | Python 3 | |
9 | Python 3 | |
10 | Python 3 | |
11 | Python 3 | |
12 | Python 3 | |
13 | Python 3 | |
14 | Python 3 | |
15 | Python 3 | |
16 | Python 3 | |
17 | Python 3 | |
18 | Python 3 | |
19 | Python 3 | |
20 | Python 3 | |
# | Program | Language |
Copyright © 2020 Inovatik - All rights reserved