loops and lists update any variables inside it the for loop will simply iterate over given listperform the operations we want on each elementand then stop when it reaches the end of the list tasks of this kind are very commonand for loops are extensively used in python programs the observant reader might notice that the way we defined the list years in the code above is not very scalable to long listsand quickly becomes repetitive and boring as stated abovewhen programming become repetitive and boringa better solution usually exists such is the case hereand very rarely do values in list need to be filled explicitlyas done here better alternatives include built-in python function called rangeoften in combination with for loop or so-called list comprehension we will return to these tools later in the when running the codeone can also observe that the two columns of degrees values are not perfectly alignedsince print always uses the minimum amount of space to output the numbers if we want the output in two nicely aligned columnsthis is easily achieved by using the -string formatting we introduced in the previous the resulting code can look like thisyears [ for in yearsr ( + / )** print( '{ : }{ : }'output is now nicely aligned for loop can always be translated to while loop as described abovea while loop is more flexible than for loop for loop can always be transformed into while loopbut not all while loops can be expressed as for loops for loop always traverses traverses listcarries out some processing on each elementand stops when it reaches the last one this behavior is easy to mimic in while loop using list indexing and the len functionwhich were both introduced above for loop of the form for element in somelistprocess element translates to the following while loopindex while index len(somelist)element somelist[indexprocess element index +