Python

Aaron Banerjee
Aaron Banerjee
648 Points

python issue with shopping list 3

posistion = abs(int(posistion))
  except ValueError:
    position = None
  if posistion is not None:
    shopping_list.insert(posistion-1,item)
  else: 
    shopping_list.append(item)
    show_list()

workspaces is saying there is an issue with the line 'shopping_list.insert(posistion-1,item) ' because unsupported operand type for -: 'str and int can someone please help me figure this out

1 Answer

Steven Parker
Steven Parker
94,464 Points

I'll disregard the fact that this code isn't complete for the moment, but from just what's shown here there is inconsistent spelling of a variable: "position" (normal spelling) and also "posistion" (with an extra "s").

The spelling itself doesn't matter to the functionality, but it must be consistent throughout the program.