""" Trace statements illustrating control statment flow Trace statements are just print statements that tell us where we are in the code. They are distinct from a watch, which tells us the current contents of a variable. Author: Walker M. White Date: August 31, 2017 (Python 3 Version) """ def max2(x,y): """ Returns: max of x, y Shows of flow of if-else """ # Put max of x, y in z print('before if') if x > y: print('if x>y') # trace z = x print('z is '+str(z)) # watch else: print('else x<=y') z = y print('z is '+str(z)) # watch print('after if') return z def max3(x,y,z): """ Returns: max of x, y, z Shows of flow of if-elif-else """ # Put max of x, y, z in w print('before if') if x > y and x > z: print('if x>y and x>z') # trace w = x print('w is '+str(w)) # watch elif y > z: print('elif y>z and y>=x') # trace w = y print('w is '+str(w)) # watch else: print('else z>=x and z>=y') w = z print('w is '+str(w)) # watch print('after if') return w