0

I am making a consumer to customer type of program and this error occured with the following code :

TypeError: 'builtin_function_or_method' object is not subscriptable

    itemData = ["XBOX 360", "200", "NEW"]
    Product = itemData[0]
    Price = itemData[1]
    Condition = itemData[2]
    userSelect = input("Would you like to see the whole information? Yes or No.")
    if userSelect == ("Yes"):
        print[itemData[0], itemData[1], itemData[2]]  
    elif userSelect == ("No"):
        userNoSelect = input("Then would you like to see the details? 
    Command: Product, Price, Condition")
        if userNoSelect == ("Product"):
            print(Product)
        elif userNoSelect == ("Price"):
            print(Price)
        elif userNoSelect == ("Condition"):
            print(Condition)

1 Answer 1

1

You are trying to subscript the print function. The argument of print has to be written in parentheses. Try:

print(itemData[0], itemData[1], itemData[2]) 

Or if you want a list to be printed:

print([itemData[0], itemData[1], itemData[2]]) 
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.