Python script to print program state of python functions
Given the following bubblesort program
defbubblesort(sortme):
offset=1whileTrue:
swapped=Falseforiinrange(len(sortme)-offset):
ifsortme[i] >sortme[i+1]:
sortme[i], sortme[i+1] =sortme[i+1], sortme[i]
swapped=Trueoffset+=1ifnotswapped:
returnsortmeif__name__=="__main__":
bubblesort([7,8,3])This will generate the following svg image:
Given the following find max program (with bug):
deffind_max(num1, num2, num3):
max_num=0ifnum1>num2andnum1>num3:
max_num=num1elifnum2>num1andnum2>num3:
max_num=num2elifnum3>num1andnum3>num2:
max_num=num3returnmax_numif__name__=="__main__":
find_max(3,3,5)This will generate the following svg image:

