''' Purpose: demonstrate a function side-effect in Python ''' def out( x ) : ''' Does ??? ''' n = len( x ) # Get the length of the list for i in range( 0, n ) : # Loop through all the indexes from 0 to n-1 print( x ) # Print the list s = x[ i ] # Get the string at x[i] x[i] = s.capitalize() # Change the list element to the capitalized version # of s # x [ i ] = something means I'm changing the element at list index i to something # list1 = ['hi','hello'] # 0 1 # list1[1] = 'whats up' # Change element at index 1! # list1 ['hi','whats up'] # What the list now looks like # x[ i ].capitalize() # Change each element in the list at index i to 0 # Strings are immutable so we cannot change the strings themselves # Rather, we can change elements at index positions in the list itself since # LISTS are mutable (changeable)