Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python debugging

#you can get a visualization of your code at python tutor
#below there is a function that is suppossed to mutate a list
#and multiply it by 2
#using pythontutor.com copy the code below into python tutor, then follow steps
#step 1: click visualize execution
#step 2: hit next for each line of code and find the problem
#step 3: click on the line with the problem code to add a break point.
#step 4: hit next, or click the red line on the bar
#step 5: fix the code, comment and thank if this helps!

def mutate(a_list):
  b_list = []
  for item in a_list:
    new_item = item * 2
  b_list.append(new_item)
  print(b_list)

mutate([1,2,3,5,8,13])
Source by pythontutor.com #
 
PREVIOUS NEXT
Tagged: #python #debugging
ADD COMMENT
Topic
Name
3+6 =