""" lectureNote/chapters/chapt05/codes/debugging1.py Originally from http://faculty.washington.edu/rjl/classes/am583s2014/notes/python_debugging.html Debugging demo using print statements """ x = 3.5 y = -22.231 def f(z): global y x = z + 10 y = 20.19 print("+++ in function f: x = %s, y = %s, z = %s, tt=%s" % (x,y,z,'i love am129/209')) # %s also works for numbers # print("+++ in function f: x = %f, y = %f, z = %f, tt=%s" % (x,y,z,'i love am129/209')) # but in general, %f also works for all numbers return x print("+++ before calling f: x = %s, y = %s" % (x,y)) y1 = f(x) print("+++ after calling f: x = %s, y = %s, y1= %s" % (x,y,y1))