Welcome to the CSC Q&A, on our server named in honor of Ada Lovelace. Write great code! Get help and give help!
It is our choices... that show what we truly are, far more than our abilities.


+6 votes

When python executes the code to check if that specific value in the column is negative, I get an error: TypeError: 'int' object is not subscriptable.

asked in old_CSC201 by (1 point)

1 Answer

+3 votes

That error means that you have an int variable, but you are using it as a list.

For example, if my program had a variable x = 5 and later I tried to use x[2], then that error would happen because x is an int and doesn't have subscripts like [2].

If may be that in your for loops, you have a variable that you thought was storing a row, (which would be a list), but it is actually storing an index value (which would be an int).

answered by (1 point)