'int' object is not subscriptable


I’d need help, I’m trying to do a program that finds the second quartile (Q2) with the position of the quartile (PQ2). When I run it, it says : TypeError: ‘int’ object is not subscriptable, but when I remove the int, it says: TypeError: string indices must be integers. Please help!

isn’t print(numbers[pq2]) trying to print the data at index pq2 of list numbers?

i really don’t know, i’m new at this. i just search on the internet to find something useful

I’m somewhat new, but list[n] finds the list item of index n.
list = [0, 1, 2, 3]
list[0] = 0
list[3] = 3
numbers in your code adds all the inputs together. If you need them as a list, put some [ ] around them and separate with commas.

1 Like

Double check what you’re trying to do with PQ2.
You’re trying to make an int object out of a string object.

https://stackoverflow.com/questions/8220702/error-int-object-is-not-subscriptable-python

Also see the documentation here.

1 Like