(continued from previous page numbers in forward order final value of is numbers in reverse order final value of is '' fruits=["apple""banana""orange"print("list of fruits are shown below:"for in fruitsprint( ''list of fruits are shown belowapple banana orange ''explanation listing at line ' 'command 'range( )generates the five numberstherefore loop repeats itself five times sinceoutput of range starts from ' 'therefore 'iis incremented by one before printing line ' shows that the variable 'istores only one value at timeand the last stored value is ' last value of 'range( )at line ' 'variable 'jis used instead of 'iand range command generates the number from to again but in reverse order note that number of iteration in for loop depends on the number of elements length of the 'rangecommand' output and independent of the element values line ' prints the current value of 'jat each iteration finallyline ' prints the last value stores in variable 'ji ' = 'which is the last value generated by command 'range( , ,- )code in line ' shows thathow the values are assigned to the iterating variable 'ifrom list the list 'fruitscontains three itemstherefore loop will execute three timesand different elements of the list are assigned to variable 'iat each iteration apple is assign firstthen banana and lastly orange will be assigned function some logics may be used frequently in the codewhich can be written in the form of functions thenthe functions can be called whenever requiredinstead of rewriting the logic again and again in listing the function 'addtwonumadds two numbers listing function #funcex py def addtwonum(ab)sum + return(sum result addtwonum( , print("sum of numbers is % result ''sum of numbers is ''explanation listing function