Posts

Showing posts with the label for loop

Python3 for Loop

Image
Python For Loop for Loop:         The for loop is used to iterate over a sequence (list, tuple, string) or other iterable objects.      Iterating over a sequence  is called traversal. Syntax:           for element in sequence:                   body of for Here, elements is the variable that takes the value of the item inside the sequence on each iteration. Loop continues until we reach the last item in the sequence. Flow chart:                                        Eg:        lst=[10,20,30,40,50]        product=1        for ele in lst:               product*=ele        print("product is: {}".format(product)) output:: product is: 12000000 for more info : ...