Thursday, February 8, 2018

FOR loop in python

The for loop iterate over the items of any  sequence like list or a string.

Syntax:

for iter_var in sequence:
    statement(s)

Example :

a = [2,3,4,5,6]
for i in a:
    print(i)

#output :
2
3
4
5
6

For Loop with range :.

Example :
for i in list(range(5)):
    print(i)

#output :-
0
1
2
3
4

No comments:

Post a Comment

Delta Lake - Time Travel

  Time Travel allows you to query, restore, or compare data from a previous version of a Delta table. Delta Lake automatically keeps tra...